Bidirectional Text (BiDi)
Handling of mixed left-to-right (LTR) and right-to-left (RTL) text, needed for Arabic and Hebrew in multilingual content.
Bidirectional text (BiDi) refers to the handling of text that mixes left-to-right (LTR) languages like English with right-to-left (RTL) languages like Arabic and Hebrew within the same content.
The Unicode Bidirectional Algorithm (UBA) automatically determines the directionality of each character and establishes the correct display order. Numbers and punctuation have "weak directionality" that changes based on context. Unicode bidirectional text books explain how UBA works.
In HTML, the dir="rtl" attribute and <bdo> element control direction. CSS properties like direction and logical properties (margin-inline-start) are also important for BiDi support.
BiDi text also raises security concerns: Unicode directional control characters have been exploited in source code attacks (Trojan Source). Web accessibility and i18n books cover BiDi best practices.