CJK (Japanese) text garbled in CLI output and gh commands when locale is ja_JP.UTF-8

Resolved 💬 3 comments Opened Apr 7, 2026 by finelagusaz Closed Apr 7, 2026

Bug report

Description

When the terminal locale is set to ja_JP.UTF-8, two character encoding (mojibake) issues occur:

  1. CLI response rendering — Claude Code's responses containing Japanese characters are sometimes garbled in the terminal output.
  2. GitHub CLI integration — When Claude Code executes gh issue create or gh pr create with Japanese text in the title/body, the resulting GitHub issue/PR contains garbled characters. (Workaround: using --body-file with a temp file instead of --body heredoc, ref: #40396)

Environment

  • Claude Code version: 2.1.92
  • OS: macOS (Darwin 25.4.0)
  • Terminal: iTerm.app 3.6.9
  • LANG: ja_JP.UTF-8
  • Shell: zsh
  • TERM: xterm-256color

Steps to reproduce

  1. Set terminal locale to ja_JP.UTF-8 (export LANG=ja_JP.UTF-8)
  2. Configure Claude Code to respond in Japanese (e.g., via CLAUDE.md instruction)
  3. Observe garbled characters in CLI output
  4. Ask Claude Code to create a GitHub issue with Japanese text via gh issue create --body "..." — the resulting issue contains mojibake

Expected behavior

Japanese (and other CJK) text should render correctly in both CLI output and when passed to shell commands like gh.

Additional context

The --body-file workaround (writing body to a temp file first) avoids the gh mojibake, suggesting the issue may be in how Claude Code passes multibyte strings to shell arguments.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗