我有一个 VB.Net 脚本,它从包含日文、中文、韩文和英文字符的数据库中保存 CSV。
该文件在纯文本编辑器中打开良好,但在 Excel 中显示“问号”字符、其他明显随机字符或破折号。无论我在导入数据时选择哪种编码格式,它都会这样做。
我必须打开文件的代码如下所示
Response.ContentType = "text/csv"
Response.AddHeader("Content-Disposition", "attachment; filename=notifications.csv")
Dim utf8 As New UTF8Encoding()
Dim strW As New IO.StreamWriter("\windows\temp\notifications.csv", False, utf8)
strW.Write(utf8.GetPreamble())
*编辑:*显然这只发生在 Excel 2011 for Mac