claude-code - 💡(How to fix) Fix Bidirectional text rendering: mixed Arabic/English on the same line breaks visual order [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52316Fetched 2026-04-24 06:10:25
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Timeline (top)
labeled ×4commented ×1subscribed ×1

When Claude Code's VSCode extension renders a line containing both Arabic (RTL) and English (LTR) text, the visual order of words is incorrect. The Unicode Bidirectional Algorithm picks up the first strong directional character and applies it as the base direction for the whole paragraph, which causes embedded LTR runs (and vice versa) to appear in unexpected positions.

Root Cause

The Arabic-speaking developer community is not small and should not be treated as an afterthought. Arabic is spoken by 400+ million people, and a rapidly growing share of them are software developers shipping production code — many of whom write in a mix of Arabic and English every single day (variable names, identifiers, and English keywords are unavoidable in any technical conversation).

A broken bidi renderer makes Claude Code actively painful to use for this audience. This is not a cosmetic polish issue — it directly affects readability of every assistant response that mixes scripts, which is most of them for Arabic-speaking users. We expect (and deserve) the same baseline rendering quality that LTR users get by default.

Please prioritize this accordingly.

Code Example

مرحبا hello يا صديقي world
RAW_BUFFERClick to expand / collapse

Description

When Claude Code's VSCode extension renders a line containing both Arabic (RTL) and English (LTR) text, the visual order of words is incorrect. The Unicode Bidirectional Algorithm picks up the first strong directional character and applies it as the base direction for the whole paragraph, which causes embedded LTR runs (and vice versa) to appear in unexpected positions.

Why This Matters

The Arabic-speaking developer community is not small and should not be treated as an afterthought. Arabic is spoken by 400+ million people, and a rapidly growing share of them are software developers shipping production code — many of whom write in a mix of Arabic and English every single day (variable names, identifiers, and English keywords are unavoidable in any technical conversation).

A broken bidi renderer makes Claude Code actively painful to use for this audience. This is not a cosmetic polish issue — it directly affects readability of every assistant response that mixes scripts, which is most of them for Arabic-speaking users. We expect (and deserve) the same baseline rendering quality that LTR users get by default.

Please prioritize this accordingly.

Reproduction

Ask Claude any question and have it produce a response containing mixed Arabic + English on a single line, e.g.:

مرحبا hello يا صديقي world

Expected

Each directional run displays in its logical/intended position, regardless of the surrounding paragraph direction.

Actual

Words appear reordered visually. The English word world ends up on the wrong side of the Arabic text. (Screenshot can be attached.)

Suggested Fix

Wrap directional runs in the markdown renderer with Unicode bidi isolates:

  • U+2068 FIRST STRONG ISOLATE (FSI) … U+2069 POP DIRECTIONAL ISOLATE (PDI)
  • Or use <bdi> elements if the renderer outputs HTML

This is the standard fix for chat-style UIs that mix scripts (used by Slack, Discord, GitHub markdown rendering, etc.).

Environment

  • Claude Code: VSCode extension
  • OS: macOS (Darwin 25.0.0)

extent analysis

TL;DR

Wrap directional runs in the markdown renderer with Unicode bidi isolates to fix the incorrect visual order of words.

Guidance

  • Verify the issue by reproducing the problem with a mixed Arabic and English response from Claude, such as مرحبا hello يا صديقي world.
  • Apply the suggested fix by wrapping directional runs with Unicode bidi isolates (U+2068 and U+2069) or using <bdi> elements if the renderer outputs HTML.
  • Test the fix with different combinations of Arabic and English text to ensure the visual order is correct.
  • Consider consulting the Unicode Bidirectional Algorithm documentation to understand the underlying cause of the issue.

Example

<!-- Using Unicode bidi isolates -->
مرحبا {{U+2068}}hello{{U+2069}} يا صديقي {{U+2068}}world{{U+2069}}

<!-- Using <bdi> elements -->
مرحبا <bdi>hello</bdi> يا صديقي <bdi>world</bdi>

Notes

The suggested fix is a standard solution for chat-style UIs that mix scripts, and it is used by other platforms such as Slack, Discord, and GitHub markdown rendering.

Recommendation

Apply the workaround by wrapping directional runs with Unicode bidi isolates or using <bdi> elements, as this is a well-established solution for fixing bidi rendering issues in mixed-script text.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING