Unicode control characters

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Many Unicode control characters are used to control the interpretation or display of text, but these characters themselves have no visual or spatial representation. For example, the null character (U+0000 <control-0000> control characters) is used in C-programming application environments to indicate the end of a string of characters. In this way, these programs only require a single starting memory address for a string (as opposed to a starting address and a length), since the string ends once the program reads the null character.

ISO 6429 control characters (C0 and C1)[edit]

The control characters U+0000–U+001F and U+007F come from ASCII. Additionally, U+0080–U+009F were used in conjunction with ISO 8859 character sets (among others). They are specified in ISO 6429 and often referred to as C0 and C1 control codes respectively.

Most of these characters play no explicit role in Unicode text handling. The characters U+0000 <control-0000> (NUL), U+0009 <control-0009> tab key (HT), U+000A <control-000A> newline (LF), U+000D <control-000D> (CR), and U+0085 <control-0085> (NEL) are commonly used in text processing as formatting characters.

Unicode introduced separators[edit]

In an attempt to simplify the several newline characters used in legacy text[citation needed], Unicode introduces its own newline characters to separate either lines or paragraphs: U+2028 LINE SEPARATOR (HTML &#8232;) and U+2029 PARAGRAPH SEPARATOR (HTML &#8233;). These characters are text formatting only, and not control characters.

Language tags[edit]

Unicode previously included 128 characters, now deprecated, for language tags. These characters essentially mirrored the 128 ASCII characters but were used to identify the subsequent text as belonging to a particular language according to BCP 47. For example, to indicate subsequent text as the variant of English as written in the United States, the initiating ‘Language Tag character’ (U+E0001) followed by the sequence ‘Tag Small Letter e’ (U+E0065), ‘Tag Small Letter n’ (U+E006E), ‘Tag Hyphen-minus’ (U+E002D), ‘Tag Small Letter u’ (U+E0075) and ‘Tag Small Letter s’ (U+E0073) would have been used.

These language tag characters would not be displayed themselves. However, they would provide information for text processing or even for the display of other characters. For example, the display of Unihan ideographs might have substituted different glyphs if the language tags indicated Korean than if the tags indicated Japanese. Another example, might have influenced the display of decimal digits 0 through 9 differently depending on the language they appeared in.

The tag characters U+E0001, U+E0020–U+E007E, and U+E007F were deprecated in Unicode 5.1 (2008) and should not be used for language information.[1]

With the release of Unicode 8.0 (2015), U+E0020–U+E007E are no longer deprecated characters. (U+E0001 LANGUAGE TAG and U+E007F CANCEL TAG remain deprecated.) The change was made "to clear the way for the potential future use of tag characters for a purpose other than to represent language tags".[2] Unicode states that "the use of tag characters to represent language tags in a plain text stream is still a deprecated mechanism for conveying language information about text.[2]

Interlinear annotation[edit]

Three formatting characters provide support for interlinear annotation (U+FFF9 ANCHOR, U+FFFA SEPARATOR, U+FFFB TERMINATOR). This may be used for providing notes that would typically be displayed between the lines of other text. Unicode considers such annotation to be rich text and recommends using other protocols for such annotation. The W3C Ruby markup recommendation is an example of an alternate protocol supporting more advanced interlinear annotation.

Bidirectional text control[edit]

Unicode supports standard bidirectional text without any special characters. In other words Unicode conforming software should display right-to-left characters such as Hebrew letters as right-to-left simply from the properties of those characters. Similarly, Unicode handles the mixture of left-to-right-text alongside right-to-left text without any special characters. For example, one can quote Arabic (“بسم الله”) (translated into English as "Bismillah") right alongside English and the Arabic letters will flow from right-to-left and the Latin letters left-to-right. However, support for bidirectional text becomes more complicated when text flowing in opposite directions is embedded hierarchically, for example if one quotes an Arabic phrase that in turn quotes an English phrase. Other situations may also complicate this, such as when an author wants the left-to-right characters overridden so that they flow from right-to-left. While these situations are fairly rare, Unicode provides twelve characters (U+061C, U+200E, U+200F, U+202A, U+202B, U+202C, U+202D, U+202E, U+2066, U+2067, U+2068, U+2069) to help control these embedded bidirectional text levels up to 125 levels deep.[3]

Variation selectors[edit]

Many characters map to alternate glyphs depending on the context. For example, Arabic and Latin cursive characters substitute different glyphs to connect glyphs together depending on whether the character is the initial character in a word, the final character, a medial character or an isolated character. These types of glyph substitution are easily handled by the context of the character with no other authoring input involved. Authors may also use special-purpose characters such as joiners and non-joiners to force an alternate form of glyph where it would not otherwise appear. Ligatures are similar instances where glyphs may be substituted simply by turning ligatures on or off as a rich text attribute.

However, for other glyph substitution, the author's intent may need to be encoded with the text and cannot be determined contextually. This is the case with character/glyphs referred to as gaiji where different glyphs are used for the same character either historically or for ideographs for family names. This is one of the gray areas in distinguishing between a glyph and a character. If a family name differs slightly from the ideograph character it derives from, then is that a simple glyph variant or a character variant. As of Unicode 3.2 and 4.0, the character set now includes 256 variation selectors so that these combining mark characters can select from 256 possible character/glyph variations for the preceding character.

Control pictures[edit]

Unicode provides graphic characters for representing C0 control codes (and space and a generic newline) in the Control Pictures block. They are visual representations, not the actual control codes themselves. There are no equivalent characters for the C1 control codes.

Control Pictures[1][2]
Official Unicode Consortium code chart (PDF)
  0 1 2 3 4 5 6 7 8 9 A B C D E F
1.^ As of Unicode version 13.0
2.^ Grey areas indicate non-assigned code points

See also[edit]


  1. ^ "RFC6082: Deprecating Unicode Language Tag Characters: RFC 2482 is Historic". Internet Engineering Task Force (IETF). November 2010.
  2. ^ a b "Unicode 8.0.0, Implications for Migration". Unicode Consortium.
  3. ^ "UAX #9: Unicode Bidirectional Algorithm". Unicode Consortium. 2018-05-09.