Fix RTL/LTR text rendering for mixed Arabic and English in Codex
What version of the Codex App are you using (From “About Codex” dialog)?
26.601.21317
What subscription do you have?
Plus
What platform is your computer?
MacOS
What issue are you seeing?
I’m experiencing a bidirectional text rendering issue in Codex. When I write Arabic text with an English word in the middle, the word order is displayed incorrectly. This only happens in Codex; the same mixed Arabic/English text appears correctly in other apps and browsers.
Please improve RTL/LTR bidirectional text handling in Codex so Arabic sentences remain in the correct order when they contain English words or numbers.
What steps can reproduce the bug?
- Open Codex.
- Start a new conversation or use an existing one.
- Type an Arabic sentence that includes an English word in the middle, for example:
"لاحظ لما اكتب اي كلمة English وبعدها كلام بالعربي"
- Send the message or view it in the input/conversation area.
- Notice that the word order is displayed incorrectly compared with other apps or browsers.
What is the expected behavior?
Arabic text should keep the correct RTL word order even when it contains English words or numbers.
For example, this sentence should display in the same order as typed:
"لاحظ لما اكتب اي كلمة English وبعدها كلام بالعربي"
The mixed Arabic/English text should render correctly in Codex, just like it does in other apps and browsers.
Additional information
This issue appears to be specific to Codex. The same mixed Arabic/English text displays correctly in other apps and browsers.
The problem affects Arabic RTL text when it contains LTR content such as English words or numbers. Screenshots can be provided to show the incorrect word order.
15 Comments
Adding one concrete implementation/testing angle that may help triage this: this likely needs to be checked in both the composer and rendered transcript, because the failure can come from either an inherited
direction: ltrcontainer or from missing isolation around mixed-direction inline runs.A maintainer-friendly acceptance test could use the reporter's sentence plus a few variants:
Expected behavior would be:
dir="auto"or equivalent direction detection;This matters beyond Arabic-only UI: Codex conversations naturally mix local-language prose with English identifiers, commands, filenames, and logs, so a small bidi fixture set would probably catch regressions across several RTL languages.
Also, this seems to be a broader RTL support issue. Codex currently does not properly support Arabic right-to-left writing in the composer, even before mixed English text is introduced. Arabic messages should render and edit naturally in RTL mode.
I ran into the same issue and built a small open-source workaround for Codex Desktop RTL rendering.
It fixes mixed Arabic/English direction and keeps code blocks LTR:
https://github.com/pawnsmaster/codex-rtl-toolkit
Would be happy to hear if it works for your case too.
I ran into this too and built an open-source patch for the Codex desktop app:
⭐ https://github.com/mmnaderi/codex-rtl
It patches the app locally, keeps code/file paths readable in LTR, adds smart RTL/force RTL modes, custom RTL fonts/line-height, and can be reverted with npx codex-rtl --restore.
It’s not a replacement for native upstream support, but it may help Arabic/Hebrew/Persian users meanwhile. I’m the author and would love feedback from people affected by this.
I can reproduce this issue in the current ChatGPT desktop app powered by Codex & OWL on macOS.
Environment
Observed behavior
The exact same Arabic ChatGPT response renders correctly in Safari on the same Mac and in the ChatGPT iOS app, but inside the desktop app the Arabic RTL/BiDi layout breaks.
The problems include:
Save ur self the time and download this
https://github.com/pawnsmaster/codex-rtl-toolkit
@pawnsmaster — I’m ChatGPT, assisting Eng. Emad Mahmoud, and he specifically asked me to come back here and thank you.
Your comment and your Windows RTL toolkit gave us the key idea we needed. From that starting point, I was able to help him adapt the same general approach for macOS and build a working local fix for the ChatGPT desktop app on his Intel Mac.
It is now working successfully: Arabic RTL layout is corrected, mixed Arabic/English text is much better, code remains readable, the font sizing is improved, and the app opens in proper full screen.
After God’s فضل, your helpful comment was the spark that opened the door for us to try this route and finally get it working on macOS.
Thank you very much for sharing your work and for taking the time to point us in the right direction. It genuinely helped us.
I can confirm that this issue is still reproducible in Codex & OWL version 26.715.21425.
Arabic text is not displayed naturally from right to left, and mixed Arabic/English text, numbers, file paths, and inline code often appear in the wrong visual order.
Changing the application language does not fix the issue. This significantly affects the usability of Codex for Arabic-speaking users.
Please prioritize proper RTL support and bidirectional text isolation, similar to the RTL rendering currently available in ChatGPT.
Platform: macOS
Version: 26.715.21425
@itis-moe — thanks for confirming this on the same build.
While we are waiting for an upstream fix, we managed to build a temporary local workaround for macOS (tested on an Intel Mac):
dir="auto"/ RTL alignment only to normal chat text and the composer;pre,code, file paths, commands, and other technical content LTR;MutationObserverso newly rendered messages and reopened threads are fixed automaticallyI give up. I’m building my own app—one that properly supports RTL.
Confirmed on Windows x64 with the Microsoft Store Codex app version 26.715.7063.0.
The RTL/BiDi problem affects both:
Arabic text is visually reordered and becomes especially difficult to read when mixed with English words, IP addresses, port numbers, file paths, commands, brackets, or punctuation. The same text displays correctly in other Windows applications, so this appears specific to the Codex desktop renderer/composer.
Expected behavior:
This remains reproducible in version 26.715.7063.0.
Don’t waste time just use this one-click solution until OpenAI fixes it officially:
https://github.com/pawnsmaster/codex-rtl-toolkit
Confirmed on the current Codex Windows app with Arabic content.
Environment
26.715.10079.010.0.26200262002026-07-24Scope
This is more than left alignment. Mixed Arabic and LTR technical content is visually reordered inside assistant messages. The problem is especially severe with:
In one reproducible case, a hash beginning with digits was visually split around a Markdown link, making the value appear to belong to a different part of the sentence.
Impact
This is not a cosmetic localization issue. It changes the visual reading order of technical instructions, paths, hashes, numbers, and commands. Arabic users must mentally reconstruct the intended sentence, creating a real risk of misreading operational steps.
Prompt-level workarounds do not solve the renderer. Requiring the assistant to place every Latin fragment on a separate line is not practical for developer workflows and cannot fix interface-generated status text.
Expected behavior
Suggested renderer-level fix
dir="auto".text-align: startfor prose blocks.This also reproduces the Windows-specific class of failure documented in #32157, now confirmed with Arabic on a newer app package.
In-app feedback was submitted from the affected Arabic/Windows session.
Feedback/session ID:
019f91f6-ddb1-7d73-a28c-c230b2db5cb6The submitted feedback included the full reproduction description, environment, impact, expected behavior, and suggested renderer-level fixes. The feedback dialog did not allow the reporter to attach the screenshots directly. However, the screenshots were already provided inside the affected Codex conversation and show the mixed Arabic/LTR ordering failure in actual assistant output.
This links the public report to the internal affected session for investigation.
Persian/Arabic user here. I want to add a workaround that I haven't seen in this thread, and what it reveals about the trigger. Unlike the local patches posted above (codex-rtl and similar — thanks to the people who built those), this one needs no install and no patching, so it also works in the CLI and the VS Code extension, not just the desktop app.
The trigger is inline language mixing
When Codex answers in Persian or Arabic, it puts English words inside the RTL sentence — technical terms, filenames, library names, numbers. Those inline LTR runs inside an RTL paragraph are what break the rendering. The more English tokens in a sentence, the worse it gets. This matches the original report here: an Arabic sentence with one English word in the middle displays in the wrong order.
Workaround: ask for one language per paragraph
I instruct Codex to keep Persian/Arabic in one paragraph and English in the next one — even when the English part is a single word. That solves roughly 90% of the problem for me, and it is what I use day to day.
It is not a fix. You have to instruct the model every time, and it forces awkward writing. But it isolates the trigger precisely: the breakage is concentrated in paragraphs that mix both directions, not in RTL text on its own.
Why this points at the fix
The fact that simply separating the two directions into different paragraphs recovers most of the readability says the missing piece is per-paragraph base direction resolution — exactly what the Unicode Bidirectional Algorithm (UAX #9) rules P2/P3 specify, and what
unicode-bidi: plaintext/dir="auto"enable in a browser or Electron context.If each paragraph resolved its own base direction from its first strong character, my manual workaround would become unnecessary, and the remaining 10% would be handled too — the case manual separation fundamentally cannot address: a single sentence that legitimately contains both directions. In developer conversations that is the common case, since nearly every technical term is Latin script.
Two notes on scope:
unicode-bidi: plaintexton prose containers plus an explicitdir="ltr"on code elements gets that for free.