← All posts
CodeSep 2, 2026

Why curly quotes and long dashes break code and JSON

A curly quote and a straight quote look almost identical and compare as completely different characters. That is the entire bug: " (U+201C) is not " (U+0022) to a parser, even though your eyes read them the same way. Paste a ChatGPT snippet with smart punctuation into JSON, Python, SQL or a terminal and it fails on the first curly character. Normalizing quotes and dashes to their plain ASCII versions fixes it without touching the logic.

Which characters break, and where

Curly double quotes “” and curly single quotes ‘’ break every format that reserves the straight versions as syntax. That includes JSON strings, Python and JavaScript literals, SQL queries, YAML values and shell commands. Long dashes break a different set of things: command flags expect a hyphen-minus, slugs and URLs accept only plain hyphens, and CSV columns with mixed dash characters sort and match inconsistently. The single-character ellipsis breaks fixed-width layouts and character counts that assumed three plain full stops. Fullwidth forms pasted from CJK input methods look like ASCII letters and fail the same way.

How to spot it

The error message rarely names the character. JSON reports an unexpected token at a position that looks fine, Python points at a line with a visible quote, and a URL returns a 404 for a slug you can read clearly. When the error position looks correct, suspect typography first. Paste the snippet into the cleaner on the homepage and switch on quotes to see every curly character highlighted with its replacement. Dashes and ellipses are covered by default, so those show up on the first paste with no options to set.

The safe fix

Normalize; do not retype by hand. Retyping a long snippet introduces new typos while fixing the quotes, and you still cannot see the invisible characters hiding beside them. The cleaner substitutes each curly quote with its straight version and each long dash with a hyphen, counts every change, and leaves code inside backticks byte-identical on this site. Run the whole file through the command line version when the snippet is already saved to disk. After cleaning, the visible text reads the same and the parser accepts it.

One exception to know

Keep curly quotes off when the text is prose for print and the typography is intentional. A novel manuscript or a marketing page may want real curly quotes, and normalizing them would be a loss, not a fix. The cleaner leaves quotes alone unless you opt in, which is exactly why that option exists. Code, JSON, configs, slugs and anything a machine parses should always take the normalized version.