[Bug] Thai text rendering broken in CLI — combining marks misaligned, cursor drift, not fixable by font changes
Preflight Checklist
- [x] Searched existing issues
- [x] Single focused bug report
- [x] Using latest version (Claude Code v2.1.112)
Environment
- Claude Code: v2.1.112 (CLI + VS Code extension)
- OS: macOS (latest)
- Terminals tested: Terminal.app, iTerm2
- Fonts tested: IBM Plex Mono Thai, Sarabun Mono, JetBrains Mono, default monospace
- Language: Thai (th_TH)
What's Wrong
Thai text rendering in Claude Code CLI is severely broken. Affects both input (typing Thai prompts) and output (Claude's Thai responses). Changing terminal emulator and font does NOT fix it — confirming the bug is in Claude Code itself, not the terminal/font layer.
The VS Code extension GUI renders the same Thai text perfectly. This indicates the bug is in the CLI's terminal UI rendering pipeline.
Symptoms
- Combining marks misaligned — Thai vowels (สระบน/ล่าง) and tone marks (วรรณยุกต์) appear on wrong base consonants, shift by columns
- Cursor drift — cursor jumps wrong positions when editing Thai. Backspace deletes wrong character. Arrow keys skip/double-count
- Wrapping broken — Thai has no word spaces; CLI breaks lines mid-syllable or runs off-screen
- Garbled streaming output — overlapping characters during Thai response streams, especially with mixed Thai/English/code
Likely Root Cause
Classic Unicode width calculation bug in terminal UI libraries:
- Thai base consonants = width 1
- Thai combining marks (U+0E30–U+0E3A, U+0E47–U+0E4E) = width 0
- Many JS libraries (
string-width, olderwcwidth) incorrectly count combining marks as width 1
Claude Code CLI appears to use React Ink / Node.js terminal rendering. The underlying width-calc library likely doesn't handle Thai combining marks correctly.
Same fix would help: Lao, Khmer, Vietnamese, Hindi/Devanagari, Arabic, Hebrew — any script with combining marks or RTL.
What I've Tried (None Fixed)
- [x] Fonts: IBM Plex Mono Thai, Sarabun Mono, JetBrains Mono, Nerd Font variants
- [x] Terminals: Terminal.app, iTerm2 (full settings sweep)
- [x] Locale: LANG=th_TH.UTF-8 / en_US.UTF-8
- [x] Line height adjustments
- [x] Verified terminal renders Thai correctly OUTSIDE Claude Code (
echo "สวัสดีครับ"works)
The terminal itself renders Thai fine — only Claude Code CLI breaks it.
Reproduction
claude --version # v2.1.112+
claude
# Type Thai:
> สวัสดีครับ ช่วยเขียน function Python คำนวณ VAT 7% ให้หน่อย
# Observe: cursor drift, misaligned tone marks, backspace eats wrong char
Impact
Claude Code CLI is effectively unusable for Thai developers who need:
- Thai prompts (natural for non-native-English speakers)
- Thai responses (documentation, code comments, explanations)
- Work on Thai-language projects/localization
Forces Thai users into VS Code extension exclusively — excluding SSH, tmux, remote servers, CI/CD workflows.
Likely affects hundreds of thousands of non-English developers globally (all combining-mark scripts).
Requests
- Audit width-calculation in CLI rendering code for Thai and similar scripts
- i18n test suite — add Thai, Vietnamese, Hindi, Arabic to CLI rendering tests
- Document known limitations so users don't waste hours tweaking fonts
--plain-outputor--no-tuiflag as workaround — let non-Latin users bypass broken TUI
Context
Not related to #51440 (Opus 4.7 regression) — this is an i18n bug affecting all models.
Thai developer, Max 20x user, Claude Code 8-12 hr/day for Odoo ERP consulting. Happy to provide Thai test corpora or beta-test fixes.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗