esvit / ng-table-export

Export data from ngTable to CSV
BSD 3-Clause "New" or "Revised" License
44 stars 95 forks source link

Improvement suggestion: prepend BOM to CSV #3

Open Myrmex opened 10 years ago

Myrmex commented 10 years ago

Hi, I'm using this code and when I open the file with the default CSV handler, which like in several other machines happens to be Excel, I get garbage characters instead of my Unicode characters. Yet, the CSV is built correctly and I can see it if I save it before opening. This is a known issue for Excel, and the workaround is prepending the CSV with the BOM code, by changing your code at line #20 to data = '\uFEFF'; instead of just data='';. This way, any modern version of Excel (probably above 2003) opens the file correctly. Maybe you could consider integrating this change into your code. Thank you!

floydpink commented 9 years ago

Since this repo was not being updated, we forked it and would welcome suggestions like these that could improve the library.

Check out https://github.com/kollavarsham/ng-table-to-csv