Bidirectional isolate
ID: bidirectional-isolate
A bidirectional isolate is a span treated as a directional unit by the Unicode Bidirectional Algorithm. Its internal text is resolved separately from the surrounding text; the isolate as a whole behaves neutrally in its surroundings. This limits directional interaction when inserting a span whose contents have their own writing direction.[ref]
Unicode Bidirectional Algorithm (Revision 51) by the Unicode Consortium. sections2 and2.4: isolated content and external behavior of the isolate
Unicode directional controls can delimit the span: LRI (
U+2066) chooses left-to-right isolation, RLI (U+2067) chooses right-to-left isolation, FSI (U+2068) infers direction from the first relevant strong character, and PDI (U+2069) terminates the isolate. Higher-level markup can express equivalent isolation without storing those explicit control characters.[ref]Unicode Bidirectional Algorithm (Revision 51) by the Unicode Consortium. sections2.4–2.5 and2.7: isolate controls, termination and markup
An original record-layout example has three fields: a fixed prefix, a user-supplied name and a fixed suffix containing punctuation and an identifier. Treat the inserted name as one isolated span. The outer layout then works with that span as a unit, while its contents receive their own directional processing. A name containing both letters and digits still needs internal reordering; isolation does not prescribe a reversal of every character inside it.
For a reproducible plain-text notation, write the sequence as
prefix RLI payload PDI suffix, with the uppercase labels standing for control code points rather than literal letters in the displayed text. This notation documents the boundary without hiding directional controls in the source example. An actual test should record the concrete payload, paragraph direction, Unicode version and line boundaries as well.Nesting introduces another distinction: a first-strong isolate determines its direction from an eligible strong character outside nested isolates. A direction already enclosed in a nested span need not choose the enclosing span's direction. Naming the span boundary and the rule used to choose its direction makes this behavior explicit.[ref]
Unicode Bidirectional Algorithm (Revision 51) by the Unicode Consortium. section2.4, FSI description; definitionsBD8–BD9: isolate initiators and matching terminators
New to topics? Read the docs here!