I have the following code:
output = ...
(some comma-separated data)
Response.Clear
'Response.ChartSet = "UTF-8"
'Response.CodePage = 65001
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "filename=myfile.csv;"
Response.Write(output)
Response.End
Now, everything is working just fine with having the data itself and generating a virtual CSV file for direct download, but if I have a non-ascii data in one or more of the fields (columns), I don't get it in UTF-8 in the generated UTF-8.
How can I set the content of the generated file to be in UTF-8??
Each of the commented lines in this code doesn't seem to affect the output...
Further to my comments if you are opening your CSV in Excel and wondering why the
UTF-8
encoding isn't working, don't worry this is a side effect of how Excel identifiesUTF-8
CSV data.Try adding this before writing your output
Useful Links