Write/Edit tools silently convert curly quotes (U+2019) to straight quotes (U+0027)

Resolved 💬 3 comments Opened Feb 7, 2026 by ArtKoKo Closed Feb 11, 2026

Related issue

Relates to #1986 — which reports that Edit cannot distinguish between straight and curly quotes. This issue documents the root cause: the Write and Edit tools silently normalize curly quotes to straight quotes before any comparison or write occurs.

Environment

  • Platform: Anthropic API
  • Claude CLI version: Claude Code (claude-opus-4-6)
  • Operating System: macOS Darwin 25.2.0
  • Terminal: zsh

Bug description

The Write and Edit tools silently convert Unicode curly apostrophes ' (U+2019, RIGHT SINGLE QUOTATION MARK) into ASCII straight apostrophes ' (U+0027) when writing file content. Other multi-byte UTF-8 characters (ç, è, é) are preserved correctly.

This explains why #1986 sees "no changes to make" — both old_string and new_string are normalized to straight quotes before comparison, making them identical.

Reproduction steps

  1. Ask Claude Code to write a file containing curly apostrophes ' (U+2019):

``
Write a temporary file containing: Test d'apostrophe courbe
``

  1. Read the file back and inspect with hexdump -C

Expected behavior

Bytes e2 80 99 (UTF-8 encoding of U+2019) should appear in the output file.

Actual behavior

Byte 27 (ASCII straight apostrophe U+0027) appears instead. All curly quotes are silently downgraded.

Hexdump proof:

00000000  54 65 73 74 20 64 27 61  70 6f 73 74 72 6f 70 68  |Test d'apostroph|
                       ^^
                    0x27 = straight apostrophe (WRONG, expected e2 80 99)

Other UTF-8 characters in the same file are correctly encoded:

  • çc3 a7
  • èc3 a8
  • éc3 a9

Impact

  • Write tool: Cannot produce files with typographically correct quotes (French, English smart quotes, publishing, i18n)
  • Edit tool: Cannot replace straight quotes with curly quotes (#1986), because normalization makes them identical before comparison
  • Workaround: Use the Bash tool with printf '\xe2\x80\x99' instead of Write/Edit

Likely affected characters

  • ' U+2018 LEFT SINGLE QUOTATION MARK
  • ' U+2019 RIGHT SINGLE QUOTATION MARK
  • " U+201C LEFT DOUBLE QUOTATION MARK
  • " U+201D RIGHT DOUBLE QUOTATION MARK
  • Possibly U+2013, U+2014, and other typographic Unicode

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗