CSV: records, delimiters and quoted fields
RFC 4180 documents a common CSV format and the text/csv media type. It is an informational RFC; its existence does not imply that every file labeled CSV follows the same dialect.
Its description allows an optional header. Fields are separated by commas, but a quoted field can itself contain a comma, a line break or a double quote. Inside a quoted field, a double quote is represented by a doubled double quote. A physical line is therefore not always a complete logical record.
The RFC treats spaces as part of a field. Trimming every field before interpreting the codebook can change a value. Keep the source encoding, delimiter, quoting rules and header decision in the import description.
Before reading an unfamiliar file, inspect several complete records with a parser that supports the documented dialect. Check the number of fields, the interpretation of embedded line breaks and the handling of blank fields. Retain identifier columns as text until their intended representation is established.
These checks address structure. They do not establish the meaning of a blank cell, the units of a measure or whether two releases use comparable definitions.
Sources
- [S1] RFC 4180: Common Format and MIME Type for CSV Files
Draft source-check date: 2026-09-15.