📖 Typography & Character Encoding

Straight Quotes vs. Curly Quotes: Why Smart Quotes Break Code & Data

Word processors call them 'Smart Quotes'. Programmers, data analysts, and database admins call them syntax errors. Here is why curly quotes break your scripts—and how to fix them.

Key Takeaway

Straight quotes (' and ") are standard ASCII characters designed for computer syntax, code strings, and data delimiters. Curly quotes (‘ ’ “ ”) are typographic Unicode symbols designed solely for reading aesthetics. When curly quotes enter code, JSON, SQL, or CSV files, parsers fail with unexpected token or syntax errors.

The Two Worlds of Quotation Marks

To human eyes, the difference between "text" and “text” is a subtle aesthetic preference. In printed books and magazines, curved marks (known as curly quotes, smart quotes, or typographer's quotes) look professional, legible, and balanced.

To a computer parser, compiler, or database engine, they are entirely different creatures. Pasting curly quotes into a script, a terminal command, an API payload, or a CSV file is one of the most common causes of silent data corruption and runtime errors.

Comparison Table: Codepoints & Encoding

Mark Name Glyph Codepoint Encoding (Bytes) Valid in Code / JSON?
Straight Single Quote (Apostrophe) ' U+0027 1 byte (ASCII 39) Yes
Straight Double Quote " U+0022 1 byte (ASCII 34) Yes
Left Single Curly Quote ‘ U+2018 3 bytes (UTF-8) No (Syntax Error)
Right Single Curly Quote ’ U+2019 3 bytes (UTF-8) No (Syntax Error)
Left Double Curly Quote “ U+201C 3 bytes (UTF-8) No (Syntax Error)
Right Double Curly Quote ” U+201D 3 bytes (UTF-8) No (Syntax Error)

Why Do Curly Quotes Break Downstream Systems?

  1. Compilers & Interpreters (Python, JavaScript, Bash): Programming languages define string literals using ASCII 34 (") or ASCII 39 ('). When an interpreter encounters “hello”, it does not recognize the boundary of a string literal. It assumes “ is an invalid variable name, throwing SyntaxError: invalid character in identifier.
  2. JSON Data Payloads: The official JSON specification (RFC 8259) explicitly mandates ASCII double quotes (U+0022) for all object keys and string values. A single curly quote will cause JSON.parse() to crash.
  3. SQL Queries & CSV Imports: When a customer name with a curly apostrophe (like O’Connor) is imported into a naive CSV parser configured strictly for ASCII delimiters, the parser may fail on row 1,000 with unexpected token pointing at the wrong line.
  4. The SMS Encoding Trap: Cellular SMS uses the 7-bit GSM-7 character set, allowing 160 characters per message. Because curly quotes are not part of GSM-7, pasting a single curly apostrophe forces your mobile carrier to re-encode the entire message into 16-bit UCS-2. This drops your message capacity from 160 characters down to **70 characters**, tripling your transmission cost.

Why Word Processors Convert Quotes Behind Your Back

The typewriter keyboard was designed with limited space, so mechanical typewriters used a single bidirectional quote (") to serve as opening quotes, closing quotes, inch marks, and seconds.

When Microsoft Word, Google Docs, Apple Pages, and CMS editors were created, developers added an automatic feature called "Smart Quotes". As you type, the application guesses whether a quote is opening or closing based on preceding whitespace and replaces your straight keystroke with a curved Unicode character.

When you copy that text out of Google Docs or Slack into your terminal or code editor, the curly Unicode bytes travel along with it.

How to Convert Curly Quotes to Straight Quotes

To normalize your text for programming, data cleaning, or technical writing:

  • Using Text Cleaner: Paste your document into our free Clean Pasted Text tool. It detects all varieties of curly quotes and converts them to standard ASCII straight quotes in one click.
  • Disable Smart Quotes in Word / Docs: In Google Docs, go to Tools → Preferences → General and uncheck "Use smart quotes". In macOS, go to System Settings → Keyboard → Text Replacements and turn off "Use smart quotes and dashes".

Frequently Asked Questions

Are straight quotes ever appropriate in formal publishing?

In printed literature and high-end typography, curly quotes remain the standard standard for readability. However, in technical documentation, programming books, and digital configuration guides, straight quotes are preferred to ensure code examples are copy-pasteable without errors.

Can a Python script automatically detect curly quotes?

Yes. You can use regex to replace curly quotes: re.sub(r'[“”]', '"', text) and re.sub(r'[‘’]', "'", text).

What is the difference between a prime mark and a straight quote?

True mathematical prime marks (′ for feet/minutes, ″ for inches/seconds) have their own codepoints (U+2032 and U+2033). In digital typing, straight quotes are routinely substituted for primes.

Does Text Cleaner alter the words inside quotation marks?

Never. Text Cleaner strictly normalizes character codepoints and punctuation marks; it never alters, rewrites, or deletes your wording.

Free On-Device Tool
Need to clean or format text in bulk?

Paste your draft into Text Cleaner to repair smart quotes, convert dashes, and strip invisible characters in one tap.

✨ Open Text Cleaner

Related Tools & Guides

Clean Pasted Text Remove Em Dash Straighten Quotes Remove Line Breaks Sentence Case All Case Converters Browse All Guides →

Clean text from any app with the Share Sheet.

Select text in Safari, Mail, or Notes and share it to Clean Text. The cleaned version is copied back to your clipboard with a summary of what was fixed.

  • Works inside Safari, Mail, Notes, Word, and Slack
  • Counts and audits damage: '2 em dashes, 3 invisible characters removed'
  • 100% on-device: zero network requests, zero telemetry, full privacy
  • Available on iPhone, iPad, and Mac
Text Cleaner: Case Converter App Screenshot