Skip to main content

check_quoting

Function check_quoting 

Source
pub fn check_quoting<R: Read>(input: R, delimiter: u8) -> Result<(), String>
Expand description

Check that every quote in input follows RFC 4180: a quoted field opens at the start of a field, "" is a literal quote inside it, and the closing quote is followed by a delimiter or a line end. Returns the message, with its line, for the first violation.

The csv parser is deliberately lenient: an unterminated quote swallows the rest of the file into one field and a stray quote is literal text. Either would load wrong data without a word, and neither can be skipped row by row because the row boundaries are unknowable, so a file is checked whole before anything is written and a violation is fatal, --ignore-errors or not.