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

latin1 supplement separator not working #195

Open
sushovannits opened this issue Feb 16, 2021 · 0 comments
Open

latin1 supplement separator not working #195

sushovannits opened this issue Feb 16, 2021 · 0 comments

Comments

@sushovannits
Copy link

  • Operating System: macOS Catalina 10.15.7
  • Node Version: 14.13.0
  • NPM Version: 6.14.8
  • csv-parser Version: 3.0.0

Expected Behavior

Using "¬" as a separator in csv file should work. Output should look like:

[ { a: '1', 'b': '2' } ]

Actual Behavior

Parsing seems not correct. Producing something like this:

[ { 'a�b': '1�2' } ]

How Do We Reproduce?

Test file:

a¬b
1¬2

Code:

const csv = require('csv-parser');
const fs = require('fs');
var iconv = require('iconv-lite');
const fileName = ('/tmp/test.csv')
const results = []
fs.createReadStream(fileName)
// .pipe(iconv.decodeStream("utf-8"))
// .pipe(iconv.decodeStream("latin1"))
// .pipe(iconv.encodeStream("utf-8"))
.pipe(csv({
    separator: '¬'
}))
.on('data', (row) => {
    results.push(row)
})
.on('end', () => {
    // console.log(JSON.stringify(results, null, 4))
    console.log(results)
    console.log('CSV file successfully processed');
});

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

1 participant