RFC 4180 and Delimiter Detection
RFC 4180 describes a comma-separated format with CRLF records, double-quoted fields when the value contains a comma, quote or newline, and doubled quotes as the escape. Real files violate it constantly: semicolons from European locales, tabs from copy-paste, stray quotes, and records of unequal length. A parser must track quote state rather than split on the delimiter.
Sniffing the delimiter means counting candidates outside quoted regions across the first few dozen lines and choosing the one with the most consistent column count. Semicolon wins on Excel exports from locales where the decimal comma forces a different list separator; tab wins on clipboard data. Guessing from the extension alone is unreliable.