Text UtilitiesLesson 99Free preview
CSV Escape
This lesson is part of Web Developer Tools · All levels
Summary
CSV escape takes care of values containing commas, quotes, or new lines to remain considered as a single field. The general rule of RFC 4180 states that such a field is encased in double quotation marks, and the quotation marks within it are doubled. Without this handling, columns can shift and data can be corrupted when opened on the spreadsheet. This tool helps prepare secure data for import and export.
Key points
- Fields containing commas, quotes, or newlines should be wrapped with double quotes
- The quotation marks in the field are doubled into two quotation characters.
- New line is allowed in the field while the field is quoted
- The separator can be a comma, a semicolon, or a tab depending on the format
- Don't break the CSV with a simple comma split because the quotation rule will be ignored
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.