Write tool silently converts full-width CJK punctuation to half-width ASCII when overwriting files
Summary
When the Write tool overwrites a file containing full-width CJK punctuation
(,。:;?!()), those characters are silently
converted to their half-width ASCII equivalents (,, ., :, ;, ?, !, (, )).
This is a silent corruption — no error is raised. It is especially destructive
for Chinese / Japanese / Korean technical writing, LaTeX documents, and typography-sensitive
content where the distinction between full-width and half-width is semantically meaningful.
Reproduction
- Create a file
test.mdcontaining full-width CJK punctuation, e.g.:
````
你好,世界。(這是測試):「引號」
That is: 你好,世界。(這是測試):「引號」
- Have Claude Code
Readthe file, thenWriteback the exact same content.
- Inspect the file. The full-width punctuation has been replaced with half-width ASCII:
````
你好,世界.(這是測試):「引號」
Expected
Content written via Write should be byte-for-byte identical to the string passed
by the agent. Full-width Unicode characters must be preserved verbatim.
Actual
Silent replacement. Observed mappings:
| Original | Codepoint | Converted | Codepoint |
|----------|-----------|-----------|-----------|
| , | U+FF0C | , | U+002C |
| 。 | U+3002 | . | U+002E |
| : | U+FF1A | : | U+003A |
| ; | U+FF1B | ; | U+003B |
| ? | U+FF1F | ? | U+003F |
| ! | U+FF01 | ! | U+0021 |
| ( | U+FF08 | ( | U+0028 |
| ) | U+FF09 | ) | U+0029 |
Full-width CJK quote marks (「」『』) appear to be unaffected.
Related: Edit tool shows the same normalization
The Edit tool has a related failure mode. When old_string is a literal string
containing full-width punctuation, the match silently fails withString to replace not found in file. Testing suggests the agent's input is being
normalized to half-width before comparison against the actual file bytes, so the
agent cannot even produce an old_string that matches an existing full-width
punctuation mark in the file.
Impact
- Silent data corruption in CJK technical documents, LaTeX lecture notes,
research manuscripts, and other typography-sensitive writing.
- Damage is invisible until the document is compiled or rendered.
- Recovery requires one of:
gitrollback (if the file was tracked), backup
restoration, or a custom Python script that performs contextual half-width
to full-width repair based on CJK adjacency.
- I have hit this repeatedly across multiple sessions, which is what motivated
this report.
Workaround
Avoid the Write tool when rewriting files that contain full-width CJK
punctuation. Options that preserve the characters correctly:
Bash+ a Python heredoc. Python writes the bytes literally:
``bash``
python3 << 'PYEOF'
content = "..." # full content with full-width punctuation
with open(path, 'w', encoding='utf-8') as f:
f.write(content)
PYEOF
Editwithold_string/new_stringboundaries anchored to ASCII
characters only (avoid full-width boundaries, since the input appears to be
normalized before matching).
Environment
- Platform: macOS (Darwin 25.4.0)
- Claude Code: latest release as of 2026-04-20
- Model: Opus 4.7 (1M context)
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗