claude-code - 💡(How to fix) Fix Occasional garbled Chinese characters in streaming output

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Root Cause

Root cause hypothesis

RAW_BUFFERClick to expand / collapse

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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

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

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Occasional garbled Chinese characters in streaming output