Skip to content
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

Add UTF-8 BOM to CSV output #63

Closed
suzukieng opened this issue Jun 3, 2020 · 2 comments
Closed

Add UTF-8 BOM to CSV output #63

suzukieng opened this issue Jun 3, 2020 · 2 comments
Labels
bug Something isn't working exporter

Comments

@suzukieng
Copy link

By default, the table exporter seems to output UTF-8 CSV data, but without a BOM (see: https://csv.thephpleague.com/8.0/bom/)

When opening the CSV file in Excel (yes, I realize there is an Excel export option, but unfortunately that is how many users consume CSV files), special characters will end up garbled by default. You can observe this behavior with your own example (row 10, Wilhelm Röntgen).

As a workaround, is it possible to intercept the output of the exporter, and patch the Blob (put a BOM in front of it), before sending it to the browser as download?

@HalitTalha
Copy link
Owner

HalitTalha commented Jun 5, 2020

Thanks for the feedback.
As a workaround you can extend CsvExporterService and use it as your custom exporter.
Check this stackblitz: https://stackblitz.com/edit/mte-cex-demo

For those who still use excel version lower than 2013, there seems to be a known MS Office bug that makes the BOM ignored.

I'll label this as a bug later to be fixed.

@HalitTalha HalitTalha added bug Something isn't working exporter labels Jun 5, 2020
HalitTalha added a commit that referenced this issue Apr 4, 2021
HalitTalha added a commit that referenced this issue Apr 4, 2021
- Fix for #63 (Add UTF-8 BOM to CSV output)
- Fix for #93 (ERROR TypeError: Cannot read property 'hasOwnProperty' of null (mat-table-filter))
- Fix for #101 (ec6 versions replaced for util, file-saver, lodash)
@HalitTalha
Copy link
Owner

BOM is available by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter
Projects
None yet
Development

No branches or pull requests

2 participants