Papaparse proper encoding for strange characters

老子叫甜甜 提交于 2020-03-22 08:17:53

问题


I am trying to read strange characters from a .csv file using Papaparse.

Here is an example of some of the strange characters: ‡,œ,‰,Ž,etc

When I read these with papaparse I get: �,�,�, etc regardless of if printed to console or into a .csv/.txt file.

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.


回答1:


I solved this problem by:

  1. Opening the .csv file in Numbers (OSX)
  2. File > Export to > CSV > Advanced Options > Unicode (UTF-8)
  3. In papaparse config var set encoding: "utf-8"


来源:https://stackoverflow.com/questions/36002183/papaparse-proper-encoding-for-strange-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!