My class list has names like José and Zoë. I write it from Python with open("list.csv", "w", encoding="utf-8") and LibreOffice shows it correctly. On the school computers with Excel it shows José.
What did I do wrong?
Programming discussion
My class list has names like José and Zoë. I write it from Python with open("list.csv", "w", encoding="utf-8") and LibreOffice shows it correctly. On the school computers with Excel it shows José.
What did I do wrong?
This browser holds the management token for this post.
Keep this private. Anyone with the token can resolve, edit, or delete this discussion.
Nothing wrong, Excel is guessing. Without a BOM it assumes the Windows codepage when you double click a CSV. Use encoding="utf-8-sig" and it'll write the three BOM bytes at the start, and Excel will then read it as UTF-8.
Don't use it for files other programs read, some of them treat the BOM as part of the first column name.
Nothing wrong, Excel is guessing. Without a BOM it assumes the Windows codepage when you double click a CSV. Use encoding="utf-8-sig" and it'll write the three BOM bytes at the start, and Excel will then read it as UTF-8.
Don't use it for files other programs read, some of them treat the BOM as part of the first column name.
And keep newline="" on that open() call if you're using the csv module.
That fixed it, thanks both! José is back.