[BUG] Write tool silently strips non-breaking spaces (U+202F / U+00A0) from JSON files

Open 💬 2 comments Opened Jun 11, 2026 by clementbirkle

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The Write tool silently replaces literal non-breaking spaces — both U+202F (NARROW NO-BREAK
SPACE) and U+00A0 (NO-BREAK SPACE) — with regular ASCII spaces (U+0020) when writing JSON
files. No warning or diff hint is shown, making the corruption invisible until the file is
inspected manually.

What Should Happen?

The Write tool should preserve all Unicode characters as-is, including U+202F and U+00A0.
The Edit tool does not exhibit this problem — surgical edits leave surrounding bytes
untouched. Write should behave the same way.

Error Messages/Logs

Steps to Reproduce

  1. Create a JSON file containing literal U+202F or U+00A0 characters — for example, French

locale copy where typographic rules require a NBSP before ?, !, ;, : and as thousands
separators (1 250 €).

  1. Ask Claude Code to add a new key to the file. Claude uses the Write tool to rewrite the

whole file.

  1. Inspect the output: every NBSP has been silently replaced by a regular ASCII space

(U+0020).

Example — file before Write:
{ "price": "1 250 €", "question": "Comment ça marche ?" }
(spaces before € and ? and in 1 250 are U+202F)

File after Write:
{ "price": "1 250 €", "question": "Comment ça marche ?" }
(all replaced by U+0020)

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.173

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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