Michael Charles Aubrey

https://MichaelCharl.es/Aubrey

How to use Claude Code in Shift JIS

How to use Claude Code in Shift JIS

Michael Charles Aubrey // Thu Apr 09 2026

How to use Claude Code in Shift JIS

If you've ever tried using Claude Code on Windows with a Shift JIS code base, you've definitely encountered some frustrating issues. The native Read, Edit, Write, and Grep tools only work in UTF-8, and attempts to work with Shift JIS files often lead to garbled text called "mojibake" in Japanese.

I wanted a way to get around this, and what I came up with is an MCP server that provides alternative Read, Edit, Write and Grep tools that can handle CP932, the Windows variant of Shift JIS. This allows you to easily use Claude Code with Shift JIS code bases.

You can find the source code on my GitHub: MichaelCharles/cp932-tools-mcp-server

Setup

1. Install uv

If you don't have uv installed, follow the instructions here: https://docs.astral.sh/uv/getting-started/installation/

2. Download the server script

Bash:

mkdir -p ~/.claude/mcp-servers
curl -o ~/.claude/mcp-servers/cp932_server.py https://raw.githubusercontent.com/MichaelCharles/cp932-tools-mcp-server/main/cp932_server.py

PowerShell:

New-Item -ItemType Directory -Force -Path ~/.claude/mcp-servers
Invoke-WebRequest -Uri https://raw.githubusercontent.com/MichaelCharles/cp932-tools-mcp-server/main/cp932_server.py -OutFile ~/.claude/mcp-servers/cp932_server.py

3. Register the server with Claude Code

claude mcp add cp932-tools -- uv run ~/.claude/mcp-servers/cp932_server.py

4. Verify

claude mcp list

If you see cp932-tools in the output, you're all set. The next time you start Claude Code, the ReadCP932, EditCP932, WriteCP932, and GrepCP932 tools will be available.

Uninstall

claude mcp remove cp932-tools

Available Tools

  • ReadCP932 — Automatically detects and reads CP932 or UTF-8 files. Supports line offset and line limit parameters.
  • EditCP932 — Find and replace text in files, preserving the original encoding and line endings. Unicode characters that don't exist in CP932 (full-width quotes, em dashes, ellipsis, etc.) are automatically replaced.
  • WriteCP932 — Create or overwrite files in CP932 or UTF-8 encoding.
  • GrepCP932 — Recursively search directories with regex patterns. Supports glob filtering and context lines.

Each tool auto-detects whether a file is CP932 or UTF-8 and preserves the original encoding when writing back. The primary use case is Japanese source code in Shift_JIS (CP932) encoding on Windows, but the tools also work fine with UTF-8 files in mixed-encoding projects.

Usage Tips

You may need to explicitly tell Claude to use the CP932 tool variants at first (e.g., "use ReadCP932 to read this file"). Once Claude knows which tools to use for your project, it will start using them automatically and the experience becomes seamless.

I've been successfully using this to work with Claude Code on a legacy Delphi 2007 code base for the past few months, and it has been working like a charm.