claude-code - 💡(How to fix) Fix [BUG] Mojibake (U+FFFD) when writing Japanese text via Write tool in VSCode extension

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Code Example



---

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

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING