[BUG] `Write` tool intermittently corrupts files with Cyrillic characters and emoji
Environment
- Platform (select one):
- [X] Anthropic API (via Claude Code
maxsubscription) - Claude CLI version: 1.0.88 (Claude Code)
- Operating System: Artix Linux (rolling)
- Terminal: foot 1.23.1-1.1
Bug Description
The built-in Write tool intermittently corrupts files containing Cyrillic characters. The output becomes garbled, suggesting a UTF-8 encoding error during the write process. This makes generating non-English documentation unreliable.
This occurs on Linux and seems related to, but distinct from, Issue #6246 (which is specific to Windows hooks).
I cannot reliably determine the trigger; some files with Cyrillic text write correctly, while others do not. The presence of complex Markdown and emoji (e.g., 🚀, 🤖) in the text might be a contributing factor, but this is just a hypothesis.
Steps to Reproduce
- Instruct an agent (main or sub-agent) to write a multi-line
.mdfile containing a mix of Cyrillic text, Markdown formatting, and emoji. - Let the agent execute the
Writetool. - Inspect the output file for character corruption.
- Note: The bug does not occur on every attempt, which makes isolating the exact cause difficult.
Expected Behavior
The output file should contain the exact, uncorrupted Cyrillic text and emoji as generated by the agent.
Actual Behavior
The file sometimes contains garbled text, such as @825B, <8@! MB> B5AB., where Cyrillic characters have been replaced.
Additional Context
This is a significant blocker for non-English workflows. Analysis of the session log files (*.jsonl) confirms the agent generates a correct UTF-8 string in its context; the corruption appears to happen specifically within the Write tool's execution.
{
//...
"message": {
"content": [
{
"type": "tool_use",
"id": "toolu_012VJBfXEWpvWm3x5nhrgNfL",
"name": "Write",
"input": {
"file_path": "~/Github/podvoram-rf/.memory/index.md",
"content": "# База Знаний Проекта ПоДворам.рф\n\n## 📖 Описание проекта\n\n**ПоДворам.рф** — сайт для прямых продаж..."
}
}
]
}
//...
}
<img width="1280" height="408" alt="Image" src="https://github.com/user-attachments/assets/a589e91e-7198-43ad-bcdf-d3f88f7ffebb" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗