Skip to content

Add a test for CSV writeFile encoding #1495

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

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

ArtskydJ
Copy link
Contributor

@ArtskydJ ArtskydJ commented Oct 9, 2020

Summary

I saw a few issues (#995, #1473) regarding CSV output encoding, and I wondered if it was working.

Test plan

So I wrote a test... Turns out it is working.

@alubbe alubbe merged commit a487181 into exceljs:master Oct 9, 2020
@pputnam-NAVEX
Copy link

Was the new Excel document opened and checked after it was written to? I can successfully encode the file as UTF-8, check in console fine, but when Excel opens the document characters including the Hebrew text used in the test are gibberish. Notepad++ correctly displays it and if I use Notepad++ to encode it to UTF-8-BOM I can re-open the spreadsheet and it will display correctly.

@pputnam-NAVEX
Copy link

Adding:
worksheet.getCell('A1').value = "\ufeff" + worksheet.getCell('A1').value;

Right before the writeFile works, also if this same file is then read using readFile \ufeff is undetectable - unsure if this is something worth adding as BOM isn't recommended but limitations in viewability of UTF-8 characters when opening actual Excel files for non-technical or data visualization may be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants