This article is In Progress.
The bdo element (<bdo>) forces a string to be displayed in order specified by the DIR attribute. ("BDO" stands for Bi-Directional Override.)
Internationalization topics related to the
This example uses the BDO element to enforce a left-to-right reading order on a block of text.
The following string includes a product code containing some Arabic alphabets followed by hyphens and ASCII digits, which, on the whole, is expected to be displayed with the alphabet part on the left, and the number part on the right, just like N-T-12345.
Note that the order of characters of input (in other words the order of characters that is stored on disk or read from disk) is the same for the product numbers in both languages, i.e. N, HYPHEN, T, HYPHEN, 1, 2, 3, 4, 5 for English, and NUN, HYPHEN, TA, HYPHEN, 1, 2, 3, 4, 5 for Arabic.
Our product N-T-12345 will be shipped as <BDO DIR="ltr">ن-ت-12345</BDO> in Egypt.
[The solution is to override the bidirectional attribute and force the order in the block of text inside a BDO element whose DIR attribute is set to ltr. View live example]
Without the BDO tag, the expectation is broken because of the Unicode bidirectional algorithm applied implicitly. While the Arabic alphabets are given inherent right-to-left attribute and the English alphabet left-to-right attribute, symbols such as a hyphen are given neutral attribute. During the process of the bidirectional algorithm, the neutral ones are treated as either right-to-left or left-to-right depending on the context. Thus a mixture of text containing bidirectional and neutral elements may result in unwanted presentation. Use BDO tag to force the context to be strong right-to-left or left-to-right, overwriting the inherent directionality.
This element is available in HTML and script as of Microsoft Internet Explorer 5.
|HTML 5.1||W3C Working Draft|
|HTML 5||W3C Recommendation|
|HTML 4.01||W3C Recommendation|
Related pages (MSDN)
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]