[BUG] Windows: Bash tool decodes CP932 output of native commands as UTF-8, so Japanese output reaches the model as U+FFFD

Status Open
Reported on v2.1.280
Maintainer reply None cached
Activity 0 comments · opened Sep 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

On a Japanese Windows machine (console code page 932), native console programs run through the Bash tool print Shift_JIS. The tool decodes their output as UTF-8, so every Japanese character becomes U+FFFD before the model sees it. Because the bytes are replaced, the model cannot recover the text, even when it recognises the encoding problem.

Tool results recorded in the session transcript:

| Command (Bash tool) | Expected | Tool result |
|---|---|---|
| cmd //c "dir /b" in a folder containing 日本語フォルダ | 日本語フォルダ | ���{��t�H���_ |
| cmd //c "echo 日本語テスト" | 日本語テスト | ���{��e�X�g |

The same text through the PowerShell tool arrives intact (Write-Output '日本語テスト'; Get-ChildItem -Name . returned 日本語テスト and 日本語フォルダ), so only the Bash tool path is affected.

This matters beyond echo: on a Japanese system, messages from ipconfig, net, schtasks, where and other Windows tools are localized and printed in the console code page, so they would reach the model the same way. I only tested dir and echo.

What Should Happen?

The model receives 日本語フォルダ and 日本語テスト. For example: when a command's output is not valid UTF-8, decode it with the console output code page (GetConsoleOutputCP() / GetOEMCP()), or run native commands with the console code page set to 65001.

Steps to Reproduce

On Windows with system locale Japanese (ACP=932, OEMCP=932), Git Bash as the Bash tool shell:

mkdir probe && cd probe && mkdir 日本語フォルダ
claude -p --allowedTools "Bash(cmd:*)" \
  'Run exactly these two commands with the Bash tool, one call each: cmd //c "dir /b"   and   cmd //c "echo 日本語テスト" . Then quote both outputs exactly.'

Then look at the tool_result blocks in the session JSONL under ~/.claude/projects/: they contain U+FFFD where the Japanese text should be.

Claude Model

Not model-specific (the decoding happens before the model sees the output). Observed with Sonnet 5.

Is this a regression?

No. #7332 (Chinese output, code page 936) reported the same symptom in September 2025 and was closed for inactivity, not fixed.

Claude Code Version

2.1.280 (latest on npm at the time of testing)

Platform

Anthropic API (Claude Max subscription)

Operating System

Windows 11 (Japanese locale, ACP=932, OEMCP=932)

Terminal/Shell

Git Bash

Additional Information

Related: #7332 (same symptom, CP936), #81187 (PowerShell tool console encoding), #96263 (Edit tool and Shift_JIS files).

View original on GitHub ↗