Occasional garbled Chinese characters in streaming output

Resolved 💬 3 comments Opened May 16, 2026 by stormzhang Closed May 20, 2026

Description

When Claude Code streams responses containing Chinese text, occasionally a few characters appear garbled/mojibake (e.g., "看下���果" instead of "看下效果") while all surrounding characters render correctly.

Environment

  • Claude Code CLI (macOS)
  • Terminal: default zsh
  • Model: claude-opus-4-6

Root cause hypothesis

UTF-8 Chinese characters are 3 bytes each. When the streaming response chunks happen to split at a byte boundary within a multi-byte character, the terminal renders the incomplete bytes as replacement characters (�).

Reproduction

  • Not reliably reproducible — it's a race condition dependent on where chunk boundaries fall
  • Happens occasionally in longer responses mixing Chinese and ASCII text
  • Only a few characters are affected per occurrence, not entire lines

Expected behavior

All multi-byte characters should be buffered correctly before rendering, regardless of chunk boundaries.

View original on GitHub ↗

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