The CSV Format:
1. Each record is one line - Line separator may be LF (0x0A) or CRLF (0x0D0A), a line seperator may also be embedded in the data (making a record more than one line but still acceptable).
2. Fields are separated with commas.
3. Leading and trailing whitespace is ignored - Unless the field is delimited with double-quotes in that case the whitespace is preserved.
4. Embedded commas - Field must be delimited with double-quotes.
5. Embedded double-quotes - Embedded double-quote characters must be doubled, and the field must be delimited with double-quotes.
6. Embedded line-breaks - Fields must be surounded by double-quotes.
7. Always Delimiting - Fields may always be delimited with double quotes, the delimiters will be parsed and discarded by the reading applications.
Here are some examples that demonstrate the rules above. Each sample describes the data and how the reading application should interpret it.
Standard line:
Code: Select all
AAA, BBB, CCC
Code: Select all
" AAA ", "B,B,B", " CCC,,,"