Implicit directional marks
The implicit directional marks are non-printing characters used in the computerized typesetting of bi-directional text containing mixed left-to-right scripts and right-to-left scripts. Unicode defines three such characters, the left-to-right mark, the right-to-left mark and the Arabic letter mark.
Unicode
In Unicode, the implicit directional mark characters are encoded at, and. In UTF-8 these areD8 9C, E2 80 8E and E2 80 8F respectively.Usage is prescribed in the Unicode Bidirectional Algorithm.
Example of use in HTML
Left-to-Right Mark
Suppose the writer wishes to use some English text into a paragraph written in Arabic or Hebrew with non-alphabetic characters to the right of the English text. For example, the writer wants to translate, "The language C++ is a programming language used..." into Arabic. Without an LRM control character, the result looks like this:لغة C++ هي لغة برمجة تستخدم...
With an LRM entered in the HTML after the ++, it looks like this, as the writer intends:
لغة C++ هي لغة برمجة تستخدم...
In the first example, without an LRM control character, a web browser will render the ++ on the left of the "C" because the browser recognizes that the paragraph is in a right-to-left text and applies punctuation, which is neutral as to its direction, according to the direction of the adjacent text. The LRM control character causes the punctuation to be adjacent to only left-to-right text – the "C" and the LRM – and position as if it were in left-to-right text, i.e., to the right of the preceding text.
Right-to-Left Mark
Suppose instead that the writer wishes to inject a run of Arabic or Hebrew text into an English paragraph, with an exclamation point at the end of the run on the left hand side. "I enjoyed staying -- really! -- at his house." With the "really!" in Hebrew, the sentence renders as follows:I enjoyed staying -- באמת! -- at his house.
With an RLM added after the exclamation mark, it renders as follows:
I enjoyed staying -- באמת! -- at his house.
This happens because the browser recognizes that the paragraph is in a LTR script, and applies punctuation, which is neutral as to its direction, in coordination with the surrounding text. The RLM causes the punctuation to be surrounded by only RTL text—the Hebrew and the RLM—and hence be positioned as if it were in right-to-left text, i.e., to the left of the preceding text.