问题
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:
- Opening the .csv file in Numbers (OSX)
- File > Export to > CSV > Advanced Options > Unicode (UTF-8)
- In papaparse config var set encoding: "utf-8"
来源:https://stackoverflow.com/questions/36002183/papaparse-proper-encoding-for-strange-characters