我正在将数据表导出为 CSV 格式,例如:
"COL1","COL2","COL3"
"1","some text", "£232.00"
"2","some more text", "£111.00"
"3","other text", "£2.00"
使用 ashx 处理程序导出的代码相当简单:
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()
我的问题是当 Excel 尝试打开导出的文件时,字符Â
出现在所有£
符号之前,例如£232.00
,当值应该是£232.00
.