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

if fieldNames has '"', ',', the result csv format error #159

Closed
MapleMaster opened this issue Jan 19, 2017 · 1 comment
Closed

if fieldNames has '"', ',', the result csv format error #159

MapleMaster opened this issue Jan 19, 2017 · 1 comment

Comments

@MapleMaster
Copy link

MapleMaster commented Jan 19, 2017

when I use " in fieldNames, it didn't convert " to "" as the value column did this convert.

like data: [ { name: 'maple"maple', age: 23 }] get csv data: "maple""maple",23,
but fieldNames: [ 'name"name', 'age' ] get csv title: "name\"name","age", not "name""name","age", which will occur excel format error.

PS:
lib/json2csv.js +157:
str += JSON.stringify(element).replace(/\"/g, params.quotes);
maybe str += JSON.stringify(element).replace(/\\"/g, params.doubleQuotes); ? cause " JSON.stringfiy get \\"

@knownasilya
Copy link
Collaborator

PRs welcome 👍

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

Successfully merging a pull request may close this issue.

2 participants