export-csv icon indicating copy to clipboard operation
export-csv copied to clipboard

Accentuated characters (lacking UFT-8 BOM)

Open lauren7ino opened this issue 11 years ago • 3 comments

Accentuated characters not being exported correctly because the CSV is being written in UTF-8 without BOM. Without it, Excel miss-interprets these characters below: À Á Ã Â É Í Ó Õ Ú Ç à á â ã é í ó õ ú ç

The fix - Change the file creation to: a.href = 'data:text/csv;charset=utf-8,%EF%BB%BF,' ...

Keep up the good work

lauren7ino avatar Oct 13 '14 10:10 lauren7ino

I tried to change line 82 to this:

a.href = 'data:text/csv;charset=utf-8,%EF%BB%BF,' + this.getCSV().replace(/\n/g, '%0A');

... but it didn't do it for me. Here's what ExCel on the Mac got out of it:

skjermbilde 2014-10-14 kl 10 27 33

TorsteinHonsi avatar Oct 14 '14 08:10 TorsteinHonsi

Sorry for that. Remove the extra comma after %EF%BB%BF

Correct: a.href = 'data:text/csv;charset=utf-8,%EF%BB%BF' + this.getCSV().replace(/\n/g, '%0A');

See my submissions on github.

Em 14 de Out de 2014 às 09:29, Torstein Hønsi [email protected] escreveu:

I tried to change line 82 to this: a.href = 'data:text/csv;charset=utf-8,%EF%BB%BF,' + this.getCSV().replace(/\n/g, '%0A'); ... but it didn't do it for me. Here's what ExCel on the Mac got out of it:

— Reply to this email directly or view it on GitHub.=

lauren7ino avatar Oct 14 '14 11:10 lauren7ino

yes I found this work for me.

I have a series name as PTP-1 and it successfully converted it well on Excel but not sure what happen to header, it prepend some blank cell to it. excel

Thank you

infacq avatar Nov 07 '14 11:11 infacq