[Bug] Japanese (CJK) U+FFFD corruption in Write tool output and streaming response — Windows, long session
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?
Japanese characters written via the Write tool are silently corrupted into U+FFFD (replacement character \uFFFD). The same corruption appears simultaneously in the chat streaming output.
The pattern suggests UTF-8 multi-byte sequence splitting at SSE chunk boundaries — consistent with the root cause identified in #43746 (closed) — but the issue persists on Windows with Claude Code CLI in the current version.
Corruption examples (6 occurrences in a single response/file):
| Original | Corrupted |
|----------|-----------|
| 都合よくなりがち | 都合\uFFFDくなりがち |
| ところ、実在 | ところ\uFFFD実在 |
| より重要 | より\uFFFD要 |
| 恥ずかしくないか | 恥ず\uFFFDしくないか |
| 切り替える | 切り替\uFFFDる |
| ペルソナを演じさせる | ペルソナ\uFFFD演じさせる |
Pattern Analysis
- Each corrupted character is a 3-byte UTF-8 Japanese codepoint with its last byte missing, replaced by U+FFFD
- All 6 corruptions occurred within a single response — not scattered across sessions
- Both the streamed chat output and the file written by the Write tool contain identical corruption
- Occurred once during a long multi-agent session; not reproduced consistently on short sessions
What Should Happen?
All Japanese characters should be written to files and displayed in streaming output without corruption.
Steps to Reproduce
Reliable reproduction steps are unknown. The issue occurred once during an extended session:
- Run Claude Code on Windows 11 (Git Bash shell)
- Conduct a long session involving multiple sub-agent calls and large context
- Ask Claude to write a Markdown file containing substantial Japanese text via the Write tool
- Observe U+FFFD in both the terminal streaming output and the resulting file
Environment
- Claude Code version: 2.1.110
- OS: Windows 11 Pro (build 10.0.26200)
- Shell: bash (Git Bash)
- Model: claude-opus-4-6 (1M context)
- Session state at time of bug: Long session with multiple sub-agent invocations (large accumulated context)
- File type:
.md(UTF-8, no BOM)
Related Issues
- #43815 — U+FFFD corruption in Cyrillic text on Windows (Edit/Write tool) — same root cause, different language
- #43746 — Root cause analysis: TextDecoder missing
{ stream: true }(CLOSED) - #40396 — Korean/CJK U+FFFD on macOS
- #39593 — Chinese U+FFFD near Markdown formatting markers
Additional Notes
The fix proposed in #43746 (new TextDecoder('utf-8', { stream: true })) appears not to have been applied or regressed, as the same symptom recurs on the latest version (2.1.110) on Windows.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗