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

Records containing carriage returns should be auto-quoted #56

Closed mvaneerde closed 3 years ago

mvaneerde commented 3 years ago

If auto-quote is in effect, records containing line feeds (\n) are correctly auto-quoted. Also, records containing carriage return/line feed pairs (\r\n) are correctly auto-quoted. But records containing only carriage returns (\r) are not auto-quoted.

ryu1kn commented 3 years ago

Hi @mvaneerde , thanks for raising this. You're right, looking at the section 2 of point 7, CR needs to be escaped.

escaped = DQUOTE *(TEXTDATA / COMMA / CR / LF / 2DQUOTE) DQUOTE