Papaparse对奇怪字符的正确编码 [英] Papaparse proper encoding for strange characters
本文介绍了Papaparse对奇怪字符的正确编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Papaparse从.csv文件中读取奇怪的字符.
I am trying to read strange characters from a .csv file using Papaparse.
以下是一些奇怪字符的示例:‡,œ,‰,Ž等
Here is an example of some of the strange characters: ‡,œ,‰,Ž,etc
当我用papaparse阅读这些内容时,无论打印到控制台还是.csv/.txt文件,我都会得到:、、等.
When I read these with papaparse I get: �,�,�, etc regardless of if printed to console or into a .csv/.txt file.
我尝试将我的papaparse配置变量设置为各种编码类型,但均未成功.我希望这些字符在控制台打印输出和写入文件时保持不变.
I've tried setting my papaparse config variable to various encoding types with no success. I would like these characters to stay the same in console print out and when written to file.
推荐答案
我通过以下方法解决了这个问题:
I solved this problem by:
- 在Numbers(OSX)中打开.csv文件
- 文件>导出到> CSV>高级选项> Unicode(UTF-8)
- 在papaparse配置变量集编码中:"utf-8"
这篇关于Papaparse对奇怪字符的正确编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文