Skip to content

Fix saveTable() not escaping double quotes in CSV output#8637

Open
avinxshKD wants to merge 1 commit intoprocessing:mainfrom
avinxshKD:fix/savetable-csv-quoting
Open

Fix saveTable() not escaping double quotes in CSV output#8637
avinxshKD wants to merge 1 commit intoprocessing:mainfrom
avinxshKD:fix/savetable-csv-quoting

Conversation

@avinxshKD
Copy link
Contributor

Resolves #8551

Changes:
saveTable() only quoted CSV fields containing commas, but never escaped " inside them, producing malformed output. Added csvEscape() next to the existing escapeHelper, which doubles inner quotes and triggers quoting on " and \n too, not just ,. Also fixes headers, which were never quoted at all. Updated the CSV download test to assert against the actual expected RFC 4180 output instead of rebuilding the same broken string.

@avinxshKD
Copy link
Contributor Author

Hey @davepagurek @ksen0 pls take a look, added csvEscape() beside the existing escapeHelper, doubles inner quotes and triggers quoting on " and \n, not just ,. Headers get the same treatment now too.

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 this pull request may close these issues.

[p5.js 2.0 Bug Report]: saveTable() doesn't escape double quotes in CSV, round-trip corrupts data

1 participant