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
Allow use of utf-8-sig encoding for Excel-compatible CSV export #18
Comments
Thanks! I think replacing the current export behavior with this is best. |
Any objections? |
Done. |
What ever happened with this? I'm using tablib==3.2.0 and not finding anything with utf-8-sig and excel is still unable to show the emojis that are in the file correctly. |
When you export with tablib in csv, you get an unicode result, so AFAIR it's your business to write it in a file with the proper encoding. |
I'm using tablib via django-tables2 and this is what I had to do to get the encoding bytes into the file.
|
You could write a single write line with |
Exporting tables with Unicode values to CSV does not encode include the byte-order marker needed by Excel to recognize that the CSV file has Unicode in it. As a result, double-clicking on the exported CSV file will not show the correct charactersets in the cells with non-ASCII values. This is arguably an Excel limitation (see http://www.sqlsnippets.com/en/topic-13412.html) but given that tablib is presumably trying to make life easier for people dealing with Excel, this would be nice to fix.
I believe this can be addressed by using
utf-8-sig
instead ofutf-8
as the encoding during export.The following demonstrates the problem and solution using a different encoding.
If compatibility with current CSV export behavior is a concern, maybe this could be added as a new export format?
The text was updated successfully, but these errors were encountered: