MoonshotAI / MoonshotAI/kimi-cli
Arabic (RTL) text is character-reversed in interactive prompt and chat responses on Windows Terminal
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Summary
When typing Arabic text directly into the interactive kimi chat prompt, the text is echoed back on screen with every character in reversed order. The same reversal also appears in the assistant's own response text when it contains Arabic mixed with Latin/digits, inside the chat panel Kimi Code draws in the terminal.
Environment
- Kimi Code CLI version: 0.41.0
- OS: Windows 10 Pro (build 10.0.19045)
- Terminal: Windows Terminal (modern build, ConPTY)
- Locale: system locale French (Windows UI), typed content is Arabic (Unicode Arabic block)
Steps to reproduce
- Open Windows Terminal.
- Run
kimito start an interactive session. - At the
>prompt, type the Arabic wordمرحبا(logical order: م ر ح ب ا). - Observe the prompt line as you type / immediately after pressing Enter.
Expected result
The prompt should echo مرحبا in the correct logical/visual order, right-to-left, exactly as typed. As a working reference, Anthropic Claude Code CLI renders the identical input correctly in the same Windows Terminal window on the same machine.
Actual result
The prompt echoes the text with every character in the opposite order: ابحرم. This is not only alignment/direction; the individual character order is reversed.
The same reversal is visible in multi-line assistant response text mixing Arabic and English/digits, for example مرحبا Hello 123 renders scrambled inside the bordered chat panel.
Additional technical evidence
- This appears specific to the interactive raw-mode input-line editor / redraw path, not Kimi's underlying text generation.
kimi -p "<text>"captured to a file returns the Arabic text byte-correct and in the right logical Unicode order. - A real chunk-timing probe showed non-interactive output arriving as 3 separate stdout writes about 13 ms apart, with one boundary landing between an Arabic word and a following Latin segment. Partial-fragment terminal rendering can compound BiDi problems for mixed RTL/LTR text.
- Pasting Arabic instead of typing it has not been confirmed to solve Kimi specifically.
Suggested area to investigate
The component that redraws the input line/chat panel on each keystroke or content update likely needs proper Unicode BiDi resolution before drawing. Please avoid naively reversing RTL runs. Buffering complete logical lines before rendering and applying directional isolates to embedded Latin/digit runs are practical approaches that worked in a local compatibility wrapper.
Raw logs/stdout should stay in original logical Unicode order; the fix should be in the interactive rendering layer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the interactive raw-mode input-line editor and chat-panel redraw path on Windows Terminal, since the issue identifies these as the affected areas. Reproduce Arabic input and mixed Arabic/Latin response rendering, compare with kimi -p output, and verify that interactive text preserves logical Unicode order without reversing RTL characters or corrupting chunked output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, internationalization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100