ryu1kn / csv-writer

Convert objects/arrays into a CSV string or write them into a CSV file
https://www.npmjs.com/package/csv-writer
MIT License
246 stars 39 forks source link

params encoding #37

Closed jorakdev closed 4 years ago

jorakdev commented 4 years ago

is encoding to ANSI working on createArrayCsvWriter(params)?

ryu1kn commented 4 years ago

Hi @jorakdev , I’m not too sure about what you mean by that. What are you trying to achieve?

jorakdev commented 4 years ago

Hi @ryu1kn, thank you for your reply. I would like to change the default encoding to ANSI like this:

const createCsvWriter = require('csv-writer').createArrayCsvWriter; const csvWriter = createCsvWriter({ header: ['NAME', 'LANGUAGE'], path: 'path/to/file.csv', encoding: 'ANSI' });

But but by reading what ANSI encoding means. I think there is some confusion over my understanding of what ANSI encoding is. So what do you think is the right way to do it?

Thanks. :)

ryu1kn commented 4 years ago

Hmm... you can specify encoding that Node.js supports, and ANSI is not one of them.

https://stackoverflow.com/questions/14551608/list-of-encodings-that-node-js-supports

Wonder if you want ascii

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

ryu1kn commented 4 years ago

I'm closing this. If you have more questions, feel free to reopen it.

tricoos commented 1 year ago

@ryu1kn

Hmm... you can specify encoding that Node.js supports, and ANSI is not one of them.

https://stackoverflow.com/questions/14551608/list-of-encodings-that-node-js-supports

"hex" encoding generates a 0 byte file, so I assume the answer is not quite correct.