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

High/non ASCII characters in csv file are not displayed correctly when exporting from IE #7084

Closed
brannislav opened this issue Aug 21, 2017 · 4 comments

Comments

@brannislav
Copy link

brannislav commented Aug 21, 2017

When exporting High\non ASCII characters (for example "哈哈ôéàÜ의 사용") to CSV using client side export from IE 11 the characters are not displayed correctly (in the case of the example above they appear as "哈哈ôéàÜì�˜ 사용").

The issue is that when creating the blob from the csv content the BOM has to be prepended to the content.

blobObject = new win.Blob([content]);

Possible fix would be:

blobObject = new win.Blob(["\uFEFF" + content], {type: 'text/csv'})

Setting the type is optional but a good practice.
This is already done for all other browsers here:

'data:text/csv,\uFEFF' + encodeURIComponent(csv),

but since IE uses other API it has to be done for IE separately.

@KacperMadej
Copy link
Contributor

KacperMadej commented Aug 22, 2017

Hi,

Thank you for reporting.

I have tested IE11 on Win7 and Win10 - both are rendering the text correctly and exported file contains proper text. Demo: https://jsfiddle.net/qqhL3L5f/

@brannislav Could you provide a demo you have used and IE version + OS version used? Maybe the program you are using for displaying the CSV is not using correct encoding? What program have you used?

@brannislav
Copy link
Author

I reproduce the issue using Microsoft Excell 2016 (adding screenshot).
csv export opened with excell

Indeed using Notepad or Notepad++ works fine as they are not affected by the missing BOM.

However I still think that not having the BOM is an issue and will affect some applications (like MS Office). Also the exported files should be consistent regardless of the browser used and currently all other browser export csv with BOM.

Thanks,
Brani

@brannislav
Copy link
Author

Thanks, for providing a fix @TorsteinHonsi !

@TorsteinHonsi
Copy link
Collaborator

Thanks for suggesting the actual fix 👍

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

No branches or pull requests

3 participants