node-csvtojson icon indicating copy to clipboard operation
node-csvtojson copied to clipboard

Wrong encoding when loading UTF-8 csv file.

Open fel486 opened this issue 9 years ago • 4 comments

Hi, I'm having an issue related to encoding. My Worksheet is in UTF-8 encoding, but when I read it in nodejs, it's shown broken like below:

Original Text: Ajuste de horário. Shown Text: Ajuste de hor�rio.

How do I fix this?

Thanks.

fel486 avatar Oct 08 '17 01:10 fel486

What version of csvtojson you are using?

Sent from my iPhone

On 8 Oct 2017, at 02:00, Felipe S. Fernandes [email protected] wrote:

Hi, I'm having an issue related to encoding. My Worksheet is in UTF-8 encoding, but when I read it in nodejs, it's shown broken like below:

Original Text: Ajuste de horário. Shown Text: Ajuste de hor�rio.

How do I fix this?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Keyang avatar Oct 08 '17 07:10 Keyang

"csvtojson": "^1.1.9"

fel486 avatar Oct 08 '17 16:10 fel486

I discovered the .csv file I get is generated by an old system, so it might be bugged related to encoding. It's not really a problem with your package, but would be good if it was able to read this kind of csv files. So I've done this and now it reads fine when loading. Shouldn't be the best performatic solution, but I guess that's what can be done.

iconv file1csv -f latin1 -t utf-8 -o file2.csv

fel486 avatar Oct 09 '17 13:10 fel486

Glad your sorted this out. Encoding is a frequently asked question. Could possibly add a section in README for this.

Keyang avatar Oct 10 '17 21:10 Keyang