An Arabic sentence with an English product name, an email address or a phone number in it is bidirectional text. Most of the time it displays fine. When it does not, punctuation jumps, numbers swap places, and the fix is almost always isolation.
Bidirectional text, or bidi, is text that mixes right-to-left and left-to-right runs, such as an Arabic sentence containing a Latin brand name, an email address or a phone number. Software decides its display order with the Unicode Bidirectional Algorithm (UAX #9), which gives every character a direction type and works out the rest from its neighbours.
The algorithm sorts characters into three broad groups. Strong characters have a fixed direction: Arabic letters are right-to-left, Latin letters left-to-right. Weak characters, mainly digits and the signs that travel with them, take part in ordering numbers but never set the direction of a paragraph. Neutral characters, such as spaces and most punctuation, have no direction of their own and borrow one from the text around them. Most surprises come from that borrowing, when a full stop or a space sits between two runs and has to be assigned to one of them.
The direction of a whole paragraph comes from markup (dir="rtl") or, with dir="auto", from its first strong letter. In our tests on 16 November 2026, "Hello مرحبا" with dir="auto" resolved to left-to-right in Chrome 157, and our first-strong helper returned right-to-left for "2026 آيفون": the leading digits are weak, so the first Arabic letter decides. A string with no letters at all, such as +963 933 123 456, has no strong direction and takes one from its context.
| Name | Notes | |
|---|---|---|
| English | Bidirectional text, bidi | Also "mixed-direction text". The rules are the Unicode Bidirectional Algorithm. |
| Modern Standard Arabic | النص ثنائي الاتجاه | Sometimes «النص مختلط الاتجاه». |
| Also heard in Syria | bidi, «عربي وإنكليزي بنفس السطر» | Developers often keep the English word; others simply describe the problem. |
| In code or standards | UAX #9, <bdi>, dir="auto", unicode-bidi | Plus the isolate characters FSI (U+2068) and PDI (U+2069) for plain text. |
Take a course listing in an education app in Homs: «دورة C++ للمبتدئين، تبدأ السبت». The Arabic words run right to left and the name of the programming language runs left to right. The two plus signs are neutral, and they sit between the Latin C and the Arabic word that follows it. With nothing else to go on, the algorithm gives them the direction of the surrounding Arabic, so they are drawn on the far side of the C and the reader sees ++C.
Wrap the course name in <bdi> on a web page, or between FSI and PDI in a push notification, and the name is laid out on its own first, as one left-to-right unit, before it is placed in the Arabic sentence. Anything dropped into a sentence from a variable, such as a seller name or a phone number in an SMS template, deserves the same treatment: you cannot know in advance how it starts or ends.
| Where | What it does | |
|---|---|---|
| <bdi> | HTML, around inserted text | Isolates its content. In our test, Chrome 157 gave it unicode-bidi: isolate by default. |
| dir="auto" | HTML, on any element | Sets the element's direction from its first strong letter. |
| FSI + PDI (U+2068, U+2069) | Plain text: SMS, push, titles, CSV | Two invisible characters that wrap inserted text as an isolated run. |
| unicode-bidi: isolate-override | CSS, for digit groups | Forces the element's own direction on every character inside it; fixes the Arabic-Indic digit case below. |
<bdi> or a span with dir="ltr".dir="ltr" (tested 16 November 2026). The algorithm classes ٠ to ٩ as Arabic numbers, a type that counts as right-to-left when the spaces between groups are resolved, so the groups trade places. In the same test, unicode-bidi: isolate-override kept the typed order, and so does writing the number as one run with no spaces. More under Arabic-Indic digits.dir="auto" read its first strong letter.<bdi>, and the paragraph stayed right-to-left.Text that contains both right-to-left and left-to-right runs, for example Arabic with an English name or a number in it. The Unicode Bidirectional Algorithm decides how it is displayed.
Behaviour measured in headless Chrome 157 and with Node 24 on 16 November 2026.
Send us a screenshot of a line that reads wrong and we will find the character behind it.