Setting the BOM on write
See original GitHub issueHi, we use the npm module to create csv exports and are generally very happy, however we still have the issue with utf-8 encoding, that excel does not recognise the files as utf-8 immediately.
According to: http://stackoverflow.com/questions/155097/microsoft-excel-mangles-diacritics-in-csv-files adding the BOM would be the quickest fix. Is there a way to add this to the stream. Our code looks like this (we use express.js):
const csvOptions = {
headers: true,
delimiter: ';',
transform: function(entry) {
//do stuff
}
};
response.set('Content-Type', 'text/csv; charset=utf-8');
response.set('Content-Disposition', 'attachment; filename="export.csv"');
csv.write(transactions, csvOptions).pipe(response);
If there is no way to do it, an option would be amazing to set the BOM. Thx in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Turn BOM writing ON / OFF - SPFLite
The BOM command, which only affects UTF8 files allows you to control whether SPFLite should write the BOM marker at the beginning of...
Read more >The byte-order mark (BOM) in HTML - W3C
The name BYTE ORDER MARK is an alias for the original character name ZERO WIDTH NO-BREAK SPACE (ZWNBSP).
Read more >What is a Bill of Materials (BOM) and How Do You Create One?
The BOM can be thought of as the recipe used to create a finished product, presented in a hierarchical format.
Read more >Using Maven's Bill of Materials (BOM) - Reflectoring
Using the BOM is a good way the ensure consistency between the dependencies versions and a safer way in multi-module projects management.
Read more >How to Make a Bill of Materials (BOM) the Right Way
A bill of materials, also known as a BOM, is the comprehensive list of all required parts, items, raw materials, and assemblies that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Added in
v3.4.0
there is a new option calledwriteBOM
that you can set totrue
to have theBOM
character written.Thank you for the options - will check them out asap. However, having a BOM in the options, and adding the BOM to the document in the background) would still make a lot of sense inmho.