Bidirectional text
Definition
Bidirectional text: Text that mixes right-to-left and left-to-right runs, such as an Arabic sentence containing a Latin handle or ticker. Browsers order it with the Unicode Bidirectional Algorithm.
What it means
The Unicode Bidirectional Algorithm, which browsers apply, gives letters a strong direction and treats punctuation and spaces as neutral. A run of neutrals takes the direction of the strong text around it; where the two sides disagree, it takes the paragraph's direction1. That rule is why an @ placed between Arabic text and a Latin handle ends up on the wrong side of it.
The remedy is isolation: marking a fragment so it is laid out as one unit that neither disturbs nor is disturbed by the text around it. In HTML that means an element with dir="ltr" or dir="rtl" when the direction is known, and dir="auto" or the bdi element when it is not2.
Example
In a right-to-left paragraph, "@yourhandle" without isolation renders as "yourhandle@". Wrapped in a bdi element, it renders as written. A ticker such as XAUUSD wrapped with dir="ltr" stays attached to its label.
Why it matters to an IB
Every IB page in Arabic or Persian carries Latin fragments: the IB's handle, the broker's name, the instruments they discuss. Each one printed backwards tells a reader the page was not made for them. See publishing right-to-left.
Sources
- Unicode Standard Annex #9: Unicode Bidirectional Algorithm — Unicode Consortium
- Inline markup and bidirectional text in HTML — W3C Internationalization
