Repository navigation
Write tool corrupts UTF-8 multi-byte characters (box-drawing chars become NULL bytes) #13080
Description
Activity
- addedbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:linuxIssue specifically occurs on LinuxIssue specifically occurs on Linux
on Dec 4, 2025 Found 3 possible duplicate issues:
- Unicode Codepoint Corruption During Write Operation #6903
- [BUG] UTF-8 Corruption Bug #1716
- [BUG] Write tool write garbled text when write emojis to empty file - 100% reproduce #7558
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Reacted by Shaun PediciniExperiencing this issue as well. This corruption resulting in weird control chars / null bytes also started happening VERY consistently whenever Claude edits an empty markdown file.
Reacted by Nazmul IdrisThis issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
- addedautocloseIssue will be closed automaticallyIssue will be closed automatically
on Jan 6, 2026 This issue is part of a larger UTF-8/encoding bug pattern affecting Claude Code's Edit/Write tools.
I've posted a consolidated impact analysis at #13939 showing at least 6+ related issues spanning 6+ months. The technical analysis you provided here (showing
codepoint & 0xFFtruncation) is particularly valuable for debugging.Cross-linking for visibility: #13939, #7134, #7332, #7335
This affects all non-English users and should be prioritized.
🤖 Generated with Claude Code
Reacted by Nazmul Idris- removedautocloseIssue will be closed automaticallyIssue will be closed automatically
on Jan 12, 2026 This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
- locked as resolved and limited conversation to collaborators
on Feb 20, 2026
Summary
The
Writetool corrupts UTF-8 multi-byte characters by stripping the high bytes, leaving only the low byte of each Unicode codepoint. This results in files that appear as "binary" and cannot be opened in text editors.Environment
Steps to Reproduce
Ask Claude to write a file containing Unicode box-drawing characters:
Try to open the resulting file in VS Code,
bat,micro, or other text editorsEditors report the file is binary or has unsupported encoding
Expected Behavior
Box-drawing character
─(U+2500) should be encoded as 3-byte UTF-8:e2 94 80Actual Behavior
The character is written as a single byte
00(just the low byte of the codepoint)Hex dump comparison:
Corrupted file (written by Write tool):
Correct file (copy-pasted from Claude's stdout):
Pattern
The corruption consistently strips UTF-8 encoding, keeping only
codepoint & 0xFF:─e2 94 8000│e2 94 8202┌e2 94 8c0c┐e2 94 9010└e2 94 9414┘e2 94 9818Workaround
Copy-paste Claude's stdout output to a file manually instead of using the Write tool.
Impact