AIToday
AI Coding AssistantsZenn AI/MLPublished: Nov 13, 2026, 16:00 JST

Claude Code 2.1.322 garbles CP932 Japanese, rejects edits

Send on LINE
Claude Code 2.1.322 garbles CP932 Japanese, rejects edits

3 Key Points

  1. What happened

    In testing Claude Code 2.1.322, Read returned the CP932 Japanese CSV with every Japanese character replaced by U+FFFD and a "not valid UTF-8" warning, while Edit and Write refused the file and left its contents unchanged.

  2. Why it matters

    Refusing to write means the tool avoids silently replacing unreadable bytes with U+FFFD, but it also leaves the file unusable in the assistant until the encoding is handled outside it.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

By signing up you agree to the Terms of Service and Privacy Policy.

Context & Analysis

The test compared four small CSV files — one CP932 with a special character (㈱), one Shift_JIS-safe, one UTF-8 without BOM, and one UTF-8 with BOM — across Claude Code's Read, Edit, and Write tools plus pandas and iconv. pandas failed to read the CP932 file as UTF-8 with a UnicodeDecodeError, succeeded with encoding="cp932", but failed with encoding="shift_jis" at position 32 because ㈱ (U+3231) exists in CP932 but not in standard Shift_JIS. iconv showed the same split: -f CP932 succeeded, -f SHIFT_JIS failed.

Read returned the CP932 file without error but with Japanese characters replaced by U+FFFD and a warning that Edit and Write would refuse it; the UTF-8 files displayed correctly. Edit then refused the file, with the before and after copies sharing the same hash, and Write refused for both a one-line 'hello' and a two-line Japanese replacement. The refusal messages say the tools write UTF-8 and never convert encodings on their own, suggesting a shell command that keeps the original encoding.

The results partly match the official Tools reference, which says Read shows undecodable bytes as U+FFFD and Edit refuses non-UTF-8 files — the test saw both. Write, however, behaved differently from the documentation's claim that it can replace such a file if the new content has no U+FFFD. The open issue anthropics/claude-code#7134, filed in 2025-09 for a Windows-1252 file, reported that Read displayed correctly while Edit and Write corrupted the file by writing UTF-8; later comments reported Read returning U+FFFD (2026-07) and Edit switching to refusal in 2.1.296 (2026-10-11), with Write not refusing in that version. The test's Read and Edit results match those comments, though it did not try a Windows-1252 file.

FAQ
Why did Claude Code show replacement characters?
According to the test, Read does not error on non-UTF-8 files; it displays undecodable bytes as U+FFFD and appends a warning that the file is not valid UTF-8. This matches the official Tools reference, which describes this behavior for Read.
Why did Edit and Write refuse the file?
The tools write in UTF-8 and never convert a file's encoding on their own, so Edit and Write rejected the CP932 file to avoid writing back U+FFFD for bytes they could not decode. The refusal message suggests converting the file with a shell command or asking the user to convert it first.
Does this match the official documentation?
The official Tools reference says Write can replace a non-UTF-8 file if the new content contains no U+FFFD, saving it as UTF-8. But in version 2.1.322, Write refused the existing CP932 file even when the new content had no U+FFFD, and the test did not investigate whether the documentation or the version is out of date.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleLooping NVIDIA's Dory 4B boosts no-CoT reasoning most