Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save CSV WITH BOM

I have asp page which creates csv file. The problem is that this csv file is created as UTF-8 WITHOUT BOM and when I open it, some signs are not visible correctly. What should I change to save it as UTF-8 WITH BOM? If I convert it to UTF-8 WITh BOM manially in notepad++, it works.

Thanks.

    Response.Clear
    Response.ContentType = "application/vnd.ms-excel; charset=UTF-8;"
    Response.AddHeader "Content-Disposition", "attachment; filename=goodsTransfer.csv"
    Response.Charset = "UTF-8"
    Response.Write "all my data"
    Response.end
like image 771
Simon Avatar asked Mar 24 '26 23:03

Simon


1 Answers

Try:

Response.Write(ChrW(65279) & "all my data")
like image 178
Esailija Avatar answered Mar 26 '26 18:03

Esailija



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!