Bi-directional text
From Wikipedia, the free encyclopedia
Unicode |
---|
Encodings |
UCS |
Mapping |
Bi-directional text |
BOM |
Han unification |
Unicode and HTML |
Unicode and e-mail |
Unicode typefaces |
Some writing systems of the world, such as Arabic and Hebrew, are written in a form known as right-to-left (RTL), in which writing begins at the right-hand side of a page and concludes at the left-hand side. This is different from the left-to-right (LTR) direction in which languages using the Latin alphabet (such as English) are written. When LTR text is mixed with RTL in the same paragraph, each type of text should be written in its own direction, which is known as bi-directional text. This can get rather complex when multiple levels of quotation are used.
Many computer programs fail to display bi-directional text correctly. For example, the Hebrew name Sarah (שרה) should be spelled shin (ש) resh (ר) heh (ה) from right to left. Some Web browsers may display the Hebrew text in this article in the opposite direction.
There are very few scripts that can be written in either direction. Such was the case with Egyptian hieroglyphics, where the signs had a distinct "head" that faced the beginning of a line and "tail" that faced the end. Chinese can also be written in either direction, especially in signs.
Another variety of writing style, called boustrophedon, was used in some ancient Greek inscriptions, Tuareg, and Hungarian runes. This method of writing alternates direction on each successive line.
Bidirectional script support is the capability of a computer system to correctly display bi-directional text. The term is often shortened to the jargon term BiDi or bidi.
Early computer installations were designed only to support a single writing system, typically for left-to-right scripts based on the Latin alphabet only. Adding new character sets and character encodings enabled a number of other left-to-right scripts to be supported, but did not easily support right-to-left scripts such as Arabic or Hebrew, and mixing the two was not practical. It is possible to simply flip the left-to-right display order to a right-to-left display order, but doing this sacrifices the ability to correctly display left-to-right scripts. With bidirectional script support, it is possible to mix scripts from different scripts on the same page, regardless of writing direction.
In particular, the Unicode standard provides foundations for complete BiDi support, with detailed rules as to how mixtures of left-to-right and right-to-left scripts are to be encoded and displayed. In Unicode encoding, all characters are stored in writing order, and software works out which direction on the page or screen the script should be displayed.
See also: Internationalization and localization
[edit] External links
- Unicode Standards Annex #9 The Bidirectional Algorithm
- W3C guidelines on authoring techniques for bi-directional text - includes examples and good explanations
- GNU FriBiDi A free implementation of the Unicode bidirectional algorithm
- ICU International Components for Unicode contains an implementation of the bidirectional algorithm — along with other internationalization services
- UCData: "Pretty Good Bidi Algorithm Library" A small and fast bidirectional reordering algorithm that works pretty good, but not necessarily compliant to the Unicode algorithm
- Bidirectional Scripts in Desktop Software Working group for supporting BiDi in Free Software. Contains several links to readings and implementation regarding BiDi in computer systems.
- Another Wiki about BiDi
- Bidirectional text - Examples and practical advice