[Bug] Incorrect text rendering and alignment for RTL (Right-to-Left) languages

Open 💬 7 comments Opened Mar 13, 2026 by shm379

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.311.21342 (993)

What subscription do you have?

[Bug] Incorrect text rendering and alignment for RTL (Right-to-Left) languages

What platform is your computer?

macuname -mprs

What issue are you seeing?

Describe the bug

When typing or generating text in Right-to-Left (RTL) languages like Persian or Arabic, especially when mixed with English words (LTR), the text rendering breaks. The text alignment defaults to left-to-right, punctuation marks appear in the wrong places, and the word order gets visually shuffled, making the output very hard to read.

Steps to reproduce

  1. Open the macOS app / output window.
  2. Input or generate a paragraph in Persian (or Arabic) that contains a few English words (e.g., "CRM", "onboarding").
  3. Look at the rendered output.
  4. Notice that the text is left-aligned and the bidirectional (bidi) text formatting is broken.

Expected behavior

  • The text container for RTL languages should automatically detect the direction and set direction: rtl; and text-align: right;.
  • Mixed LTR words inside the RTL text should maintain their proper inline order (proper unicode-bidi handling).

Actual behavior

  • Text is aligned to the left.
  • Sentences are visually broken when an English word is inserted among Persian words.

Screenshots

<img width="1100" height="678" alt="Image" src="https://github.com/user-attachments/assets/7eeaad54-2bb0-4640-9a7a-636cc313dfb3" />

Environment

  • OS: macOS
  • Language: Persian / RTL

What steps can reproduce the bug?

Gemini said
Here are the exact steps you can use to reproduce the RTL (Right-to-Left) rendering bug, formatted clearly so you can add them directly to your GitHub issue:

Open the application: Launch the Codex macOS app and open a new document, chat, or text input window.

Input RTL text: Type or paste a paragraph of text in an RTL language, such as Persian or Arabic.

Mix in LTR words: Insert a few English words or technical terms (like "CRM", "MVP", or "onboarding") within the Persian sentences.

Observe the result: Look at how the text is rendered on the screen.

What happens (The Bug): You will see that the text forces itself to align to the left side of the screen instead of the right. Additionally, the sentence structure visually breaks and shuffles around wherever the English words are inserted, ignoring proper bidirectional (bidi) text rules.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

7 Comments

BehroozBvk · 2 months ago

I have the same problem.

meshalprogramming-cloud · 2 months ago

same problem

SMSMy · 2 months ago

I’m also experiencing this issue, and it significantly impacts real-world usage.

Reproducible Case

When mixing Arabic (RTL) with English/code (LTR), the output becomes hard to read:

Example:

  • Arabic comment + English code
  • Terminal output containing Arabic text
  • Markdown with mixed direction

Observed problems:

  • Text alignment defaults to LTR
  • Parentheses and punctuation are misplaced
  • Mixed content (Arabic + code) becomes visually inconsistent

Impact

This is not just a visual issue — it affects:

  • Code readability
  • Debugging (logs/CLI output)
  • UI correctness when generating layouts

Suggestion

Proper bidirectional text handling is needed:

  • Support for RTL direction (dir="rtl" or auto)
  • Correct Unicode Bidi algorithm implementation
  • Testing in mixed-language scenarios (Arabic + English + code)

If needed, I can provide more concrete examples or test cases.

arefshal · 2 months ago

same problem

Ebrahem-Abdon · 2 months ago

I’m also experiencing this issue, and it significantly impacts real-world usage.

Reproducible Case

When mixing Arabic (RTL) with English/code (LTR), the output becomes hard to read:

Example:

Arabic comment + English code
Terminal output containing Arabic text
Markdown with mixed direction
Observed problems:

Text alignment defaults to LTR
Parentheses and punctuation are misplaced
Mixed content (Arabic + code) becomes visually inconsistent
Impact

This is not just a visual issue — it affects:

Code readability
Debugging (logs/CLI output)
UI correctness when generating layouts
Suggestion

Proper bidirectional text handling is needed:

Support for RTL direction (dir="rtl" or auto)
Correct Unicode Bidi algorithm implementation
Testing in mixed-language scenarios (Arabic + English + code)
If needed, I can provide more concrete examples or test cases.

ctrlbstudioai-wq · 1 month ago

codex pleas help us and fixed

mmnaderi · 14 days ago

As a Persian/Farsi user, this is exactly the issue I kept hitting in Codex Desktop, especially with mixed English words, punctuation, and inline code.

I made a small open-source patcher for this:

https://github.com/mmnaderi/codex-rtl

It adds smart RTL behavior and a settings panel, while preserving code blocks as LTR.
Hope it helps until Codex gets native RTL support.