I'm exporting a table of data to CSV format, e.g.:
"COL1","COL2","COL3"
"1","some text", "£232.00"
"2","some more text", "£111.00"
"3","other text", "£2.00"
The code to export is fairly simple using an ashx handler:
context.Response.Clear()
context.Response.ContentType = "text/csv"
context.Response.AddHeader("Content-disposition", "attachment;filename=data.csv")
context.Response.AddHeader("Cache-Control", "must-revalidate")
context.Response.AddHeader("Pragma", "must-revalidate")
context.Response.Write(data)
context.Response.Flush()
context.Response.End()
My issue is when Excel tries to open the exported file the character Â
appears before all £
signs, e.g. £232.00
when the value should be £232.00
.