[BUG] Mojibake (U+FFFD) when writing Japanese text via Write tool in VSCode extension

Resolved 💬 1 comment Opened May 25, 2026 by TaiUmetsu Closed Jun 26, 2026

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?

When using the Write tool to create or overwrite files containing Japanese text, some characters are corrupted to U+FFFD (REPLACEMENT CHARACTER). This appears to be an encoding issue specific to the VSCode extension — I've seen reports that the CLI version has already fixed this.

What Should Happen?

Corruption appears randomly within the Japanese text — not always the same characters
Single Write calls producing ~5,000+ characters of Japanese seem more prone to this
Once corrupted text enters the conversation context, the model may propagate it in subsequent outputs
The Edit tool (small replacements) does NOT trigger this issue — only Write (full file creation/overwrite)

Error Messages/Logs

Steps to Reproduce

  1. Use the Write tool to create a Python file containing Japanese string literals (especially inside triple-quoted strings)
  2. Inspect the output file for U+FFFD characters

Example trigger (simplified):

Write tool → create .py file with:
text = """日本語のテキストをここに書く"""

Some characters in the output will be replaced with U+FFFD.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2,1,145

Platform

Anthropic API

Operating System

Windows 11 Pro (10.0.26100)

Terminal/Shell

VS Code integrated terminal

Additional Information

In one session, a single Write call producing a ~12,000-character Japanese text resulted in 23 instances of U+FFFD. The corruption was scattered across the file with no obvious pattern in which characters were affected.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗