且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Javascript 到 csv 导出编码问题

更新时间:2022-12-31 09:33:49

您应该在文本的开头添加 UTF-8 BOM,例如:

You should add the UTF-8 BOM at the start of the text, like:

var csvContent = "data:text/csv;charset=utf-8,%EF%BB%BF" + encodeURI(csvContent);

它在 Excel 2013 中对我有用.

It worked for me with Excel 2013.

演示小提琴