CSV Quotes Changer
Change, add, or remove quote characters in CSV files. Convert between single, double, backtick quotes or strip them entirely with RFC 4180 compliance.
About
CSV files lack a universal standard for field quoting. Some systems export with double quotes ("), others use single quotes ("), and some omit quoting entirely - causing parse failures when fields contain the delimiter character or line breaks. Importing a file quoted with " into a parser expecting " produces corrupted columns, lost rows, or silent data truncation. This tool performs deterministic quote character replacement on CSV data using a finite-state tokenizer compliant with RFC 4180. It correctly handles escaped quotes (doubled characters), fields containing embedded delimiters, and multiline field values.
The tool does not naively find-and-replace characters. It parses the full CSV structure, then re-serializes with the target quote character and chosen quoting strategy. This matters because a raw replacement of " with ' will break any field that already contains a literal apostrophe. The tokenizer resolves this by applying proper escape sequences during re-serialization. Limitations: the tool assumes consistent quoting within the source file. Mixed-quoting files (some fields single-quoted, others double-quoted) require manual inspection first.
Formulas
The CSV tokenizer operates as a finite-state machine with four states. Each input character triggers a transition that determines whether it belongs to the current field, ends the field, or modifies the quoting context.
Transition rules govern parsing behavior:
Where Q = current quote character, D = delimiter character. During re-serialization, the quoting strategy determines which fields receive the target quote character Qtarget:
Escape within re-serialized fields uses doubling: every occurrence of Qtarget inside a field value is replaced with QtargetQtarget.
Reference Data
| Quote Style | Character | Unicode | Common Usage | Escape Method | RFC 4180 |
|---|---|---|---|---|---|
| Double Quote | " | U+0022 | RFC 4180 standard, Excel, Google Sheets | Doubled: "" | Yes |
| Single Quote | ' | U+0027 | MySQL exports, some Unix tools | Doubled: '' | No |
| Backtick | ` | U+0060 | MySQL identifiers, Markdown | Doubled: `` | No |
| No Quotes | - | - | Simple numeric CSVs, TSV files | N/A (fields cannot contain delimiter) | Partial |
| Left Double Curly | โ | U+201C | Word processors, copy-paste errors | Doubled | No |
| Right Double Curly | โ | U+201D | Word processors, copy-paste errors | Doubled | No |
| Left Single Curly | โ | U+2018 | macOS auto-correct, rich text | Doubled | No |
| Right Single Curly | โ | U+2019 | macOS auto-correct, rich text | Doubled | No |
| Guillemet Double | ยซยป | U+00AB/BB | European locales, French text | Rare | No |
| Comma Delimiter | , | U+002C | Default CSV separator | - | Yes |
| Semicolon Delimiter | ; | U+003B | European locales (decimal comma conflict) | - | No |
| Tab Delimiter | \t | U+0009 | TSV files, database exports | - | No |
| Pipe Delimiter | | | U+007C | Legacy systems, HL7 medical data | - | No |
| Caret Delimiter | ^ | U+005E | Mainframe exports | - | No |
| Tilde Delimiter | ~ | U+007E | EDI/X12 transactions | - | No |