-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving CSV with unique chars using in a different encoding other than UTF-8 #28
Comments
Ok, I linked to this in #25 for anyone who comes across this issue in the future. |
I am not using this library but came across this issue since I have the same one. The BOM will not work in Excel for Mac OS X, it will only present it with some odd characters in the beginning of the file. I have not found a solution to this issue yet. |
I confirm what @robinwassen has said 4 months ago... It seems that the only "universal" solution would be to generate a windows-1252 encoded CSV. Which has yet to be done in JS. https://code.google.com/p/stringencoding/ could probably help. |
@b4stien not really the best place to talk about this, but I forked the text-encoding library just to achieve this (exporting Windows CP1252 CSV in JavaScript). See https://github.com/pmq/text-encoding and inexorabletash/text-encoding#19 for an explanation. |
@ranabra Thank you for your solution (encode in UTF-8 with BOM). It works ! |
@linhyo FYI, I'm not 100% sure anymore, but last time I checked UTF-8 (with or without BOM) wasn't working on OS X with Office 2011. ANSI (also called windows-1252) seems to be the only "universal" solution. If it helps I set up an example: https://github.com/b4stien/js-csv-encoding. |
Works for me (encode in UTF-8 with BOM). Many thank! |
And for me! Thank you! |
Thanks @ranabra |
Works great. Thanks!!!! |
Can you give a example on |
This issue saves my sleeping time. huge thanks! |
but office 2007 encoding is error |
To zh-wowtv Too late but I share for other people as example.
|
o , i use Xlsx.js and works okay |
It also works correctly when saving a file with swedish charset (encoded in iso-8859-2)! (thank you so much for this) |
How to save CSV file as ASCII? |
You can also try this: saveAs('data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + btoa(data), `PARTNER.csv`);
|
Thank you @ranabra you just saved my sanity 👍 |
obrigado... |
Works for me, thanks ! |
This is not exactly an issue, rather it is a solution
( for example a solution to: #25 )
Solution: For all your special character needs, just use UTF-8, but additionally add a BOM to make sure the file is opened correctly.
CSV for example was opened by Office Excel versions prior to Office 2007 with the wrong ANSI 1252 encoding by default.
Adding a BOM will make the file open correctly (in UTF-8) in Office versions since Office 2007 (maybe needs Office SP for Office 2007)
The text was updated successfully, but these errors were encountered: