{"action":"opened","issue":{"url":"https://api.github.com/repos/lbdremy/node-csv-stream/issues/13","repository_url":"https://api.github.com/repos/lbdremy/node-csv-stream","labels_url":"https://api.github.com/repos/lbdremy/node-csv-stream/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/lbdremy/node-csv-stream/issues/13/comments","events_url":"https://api.github.com/repos/lbdremy/node-csv-stream/issues/13/events","html_url":"https://github.com/lbdremy/node-csv-stream/issues/13","id":237271863,"number":13,"title":"Error: Encoding not being detected","user":{"login":"rogeriopvl","id":38240,"avatar_url":"https://avatars2.githubusercontent.com/u/38240?v=3","gravatar_id":"","url":"https://api.github.com/users/rogeriopvl","html_url":"https://github.com/rogeriopvl","followers_url":"https://api.github.com/users/rogeriopvl/followers","following_url":"https://api.github.com/users/rogeriopvl/following{/other_user}","gists_url":"https://api.github.com/users/rogeriopvl/gists{/gist_id}","starred_url":"https://api.github.com/users/rogeriopvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogeriopvl/subscriptions","organizations_url":"https://api.github.com/users/rogeriopvl/orgs","repos_url":"https://api.github.com/users/rogeriopvl/repos","events_url":"https://api.github.com/users/rogeriopvl/events{/privacy}","received_events_url":"https://api.github.com/users/rogeriopvl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-20T16:30:59Z","updated_at":"2017-06-20T16:30:59Z","closed_at":null,"body":"I'm using `csv-stream` with express to parse a request stream (file).\r\n\r\nThis is the code I'm using:\r\n\r\n```javascript\r\nconst csv = require('csv-stream')\r\n\r\nmodule.exports = (req, res) => {\r\n  const csvStream = csv.createStream({ enclosedChar: '\"' })\r\n\r\n  req.pipe(csvStream)\r\n    .on('error', (err) => { console.error(err) })\r\n    .on('data', (data) => { console.log(data) })\r\n\r\n  req.on('end', () => { res.send('END') })\r\n}\r\n```\r\nWhen I run this, I get this error:\r\n```\r\nbuffer.js:557\r\n  throw new TypeError('Unknown encoding: ' + encoding);\r\n  ^\r\n\r\nTypeError: Unknown encoding:\r\n    at stringSlice (buffer.js:557:9)\r\n    at Buffer.toString (buffer.js:593:10)\r\n    at CSVStream.write (/(...)/node_modules/csv-stream/index.js:59:34)\r\n    at IncomingMessage.ondata (_stream_readable.js:626:20)\r\n    at emitOne (events.js:115:13)\r\n    at IncomingMessage.emit (events.js:210:7)\r\n    at IncomingMessage.Readable.read (_stream_readable.js:462:10)\r\n    at flow (_stream_readable.js:833:34)\r\n    at resume_ (_stream_readable.js:815:3)\r\n    at _combinedTickCallback (internal/process/next_tick.js:102:11)\r\n```\r\n\r\nI can fix this by adding the following to my code:\r\n\r\n```javascript\r\ncsvStream._encoding = 'utf8'\r\n```\r\n\r\nBut this is an ugly hack that I want to avoid at all cost.\r\n\r\nIs there any way to fix this from my side? Am I missing something? Or should `csv-stream` set a value for `this._encoding` coming from `options` or something similar?"}}
{"actor":{"display_login":"rogeriopvl"}}