Why CSV delimiter detection should be able to report ambiguity
A small file like 'id,name;label' can be read as two columns under either a comma or a semicolon, so picking the first delimiter in a list silently hides an unresolved choice. The article recommends parsing the text separately with each candidate delimiter and accepting only results that pass syntax and table-shape checks, such as quoting, escaped quotes, embedded newlines, and consistent field counts. A sample function selects the widest valid candidate and otherwise returns a 'needs-choice' status listing the tied delimiters. The author notes that this widest-candidate rule is only a heuristic, that a known export format or expected header schema gives stronger evidence, and that one-column files are valid rather than errors. After a user picks a delimiter, the importer should reparse the original text, show the headers and sample rows, and keep existing data until the choice is confirmed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in