# BDO - BiDi Override

Syntax | <BDO>...</BDO>

Attribute Specifications

- DIR=[ ltr | rtl ] (directionality of text)
- LANG=LanguageCode (language of text)
- core attributes

Contents | Inline elements
Contained in | Inline elements, block-level elements

The BDO element overrides the bidirectional algorithm for the enclosed text. Characters in Unicode are assigned a directionality, left-to-right or right-to-left, to allow the text to be rendered properly. For example, while English characters are presented left-to-right, Hebrew characters are presented right-to-left.

Unicode defines a bidirectional algorithm that must be applied whenever a document contains right-to-left characters. While this algorithm usually gives the proper presentation, occasionally authors must override the bidirectional algorithm and specify the directionality of the text. One such case is when Hebrew characters are stored in visual order, where the first character of a word is after the second character. Unicode assumes that the characters are stored in logical order, where the first character of a word is before the second character, so the bidirectional algorithm would result in a rendering with the first character incorrectly to the left of the second character.

The BDO element requires the DIR attribute to specify the directionality of the enclosed text. If a document contains Hebrew characters stored in visual order, one should use <BDO DIR=ltr>text</BDO> to force the proper presentation for that text.

Authors may alternatively override the bidirectional algorithm using the Unicode character &#x202D; to force left-to-right directionality or &#x202E; to force right-to-left directionality. The character &#x202C; ends the overriding of the algorithm. These characters should not be used in combination with the DIR attribute.

## More Information

- BDO in W3C HTML 4.0 Recommendation
- Introduction to the bidirectional algorithm
- Unicode
- Middle Eastern Language Issues