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

utf-8 bom causes first column value to be corrupted #131

Closed
matt-blanchette opened this issue Mar 22, 2016 · 4 comments
Closed

utf-8 bom causes first column value to be corrupted #131

matt-blanchette opened this issue Mar 22, 2016 · 4 comments

Comments

@matt-blanchette
Copy link

UTF8 files starting with BOM cause parsed csv data to be broken for the first value.

If the first row contains column names,
then the first column becomes unusable to lookup by name.

Either a code change to strip a possible BOM as the first character or a documentation update would be helpful.

@ajmas
Copy link

ajmas commented Oct 1, 2016

I am observing this in version 2.3.0. In my case the first column should be 'Type', but it is coming out as '<U+FEFF>Type'.

We should probably add some code to handle all the common scenarios, as described here:

https://en.wikipedia.org/wiki/Byte_order_mark

@matt-blanchette
Copy link
Author

I've used the strip-bom-stream module for now to handle this.

fs.createReadStream(fileName)
    .pipe( stripBomStream() )
    .pipe( csv(options) )

@pietercolpaert
Copy link

Should this fix be added to the repo or should we always use stripBomStream?

@dustinsmith1024
Copy link
Contributor

2.3.1 is published with the fix.

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

No branches or pull requests

4 participants