Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting the BOM on write

See original GitHub issue

Hi, 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: 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

doug-martincommented, Jul 30, 2019

Added in v3.4.0 there is a new option called writeBOM that you can set to true to have the BOM character written.

bizarrochriscommented, Mar 29, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found