RTL/Persian text renders garbled in interactive TUI, but correct outside Claude Code (e.g. typed directly in terminal)
Description
When Claude Code's interactive TUI renders Persian (RTL) text — in prompts, streamed output, etc. — the text displays garbled/reversed. The same Persian text typed directly into the terminal (Warp), outside of Claude Code's interactive session, renders correctly with proper RTL layout.
Environment
- Terminal: Warp
- OS: macOS (Darwin)
Likely cause
Warp has its own bidi (Unicode Bidirectional Algorithm) renderer that correctly lays out RTL text printed to it directly. Claude Code's interactive TUI appears to do its own screen/cursor management (line-wrapping, redraws via ANSI escape codes) based on left-to-right character-count assumptions. When RTL text — especially mixed with LTR punctuation, digits, or markdown — is redrawn, the TUI's cursor-position calculations conflict with the terminal's own bidi reordering, producing garbled output.
Steps to reproduce
- Open Claude Code in Warp
- Type or receive a response containing Persian/Arabic (RTL) text mixed with Latin punctuation or numbers
- Observe garbled/misordered rendering in the interactive session
Expected behavior
RTL text (Persian/Arabic/Hebrew) should render correctly in the interactive TUI, consistent with how it renders when printed directly to the terminal outside Claude Code.
Workaround
Using non-interactive/print mode (claude -p "...") or piping output to a file avoids the TUI's live cursor-redraw logic and renders correctly.