Unicode

Unicode is an industry standard designed to allow text and symbols from all languages to be consistently represented and manipulated by computers.

Unicode characters can be encoded using any of several schemes termed Unicode Transformation Formats (UTF).

The Unicode Consortium has as its ambitious goal the eventual replacement of existing character encoding schemes with Unicode, as many of the existing schemes are limited in size and scope, and are incompatible with multilingual environments. Its success at unifying character sets has led to its widespread and predominant use in the internationalization and localization of computer software. The standard has been implemented in many recent technologies, including XML, the Java programming language, and modern operating systems.

Origin and development
Unicode has the explicit aim of transcending the limitations of traditional character encodings, such as those defined by the ISO 8859 standard which find wide usage in various countries of the world, but remain largely incompatible with each other. Many traditional character encodings share a common problem in that they allow bilingual computer processing (usually using Roman characters and the local language), but not multilingual computer processing (computer processing of arbitrary languages mixed with each other).

Unicode, in intent, encodes the underlying characters — graphemes and grapheme-like units — rather than the variant glyphs (renderings) for such characters. In the case of Chinese characters, this sometimes leads to controversies over distinguishing the underlying character from its variant glyphs (see Han unification).

In text processing, Unicode takes the role of providing a unique code point — a number, not a glyph — for each character. In other words, Unicode represents a character in an abstract way, and leaves the visual rendering (size, shape, font or style) to other software, such as a web browser or word processor. This simple aim becomes complicated, however, by concessions made by Unicode's designers, in the hope of encouraging a more rapid adoption of Unicode.

The first 256 code points were made identical to the content of ISO 8859-1, to make it trivial to convert existing western text. A lot of essentially identical characters were encoded multiple times at different code points to preserve distinctions used by legacy encodings and therefore allow conversion from those encodings to Unicode (and back) without losing any information. For example, the "fullwidth forms" section of code points encompasses a full Latin alphabet that is separate from the main Latin alphabet section. In CJK fonts, these characters are rendered at the same width as CJK ideographs rather than half the width. For other examples, see Duplicate characters in Unicode.

Also, while Unicode allows for combining characters, it also contains precomposed versions of most letter/diacritic combinations in normal use. These make conversion to and from legacy encodings simpler and allow applications to use Unicode as an internal text format without having to implement combining characters. For example é can be represented in Unicode as (Latin small letter e) followed by U+0301 (combining acute) but it can also be represented as the precomposed character U+00E9 (Latin small letter e with acute).

The Unicode standard also includes a number of related items, such as character properties, text normalisation forms, and bidirectional display order (for the correct display of text containing both right-to-left scripts, such as Arabic or Hebrew, and left-to-right scripts).

Scripts covered
Unicode covers almost all scripts (writing systems) in current use today, including:


 * Arabic
 * Armenian
 * Bengali
 * Braille embossing patterns
 * Canadian Aboriginal Syllabics
 * Cherokee
 * Coptic
 * Cyrillic
 * Devanāgarī
 * Ethiopic
 * Georgian


 * Greek
 * Gujarati
 * Gurmukhi (Punjabi)
 * Han (Kanji, Hanja, Hanzi)
 * Hangul (Korean)
 * Hebrew
 * Hiragana and Katakana (Japanese)
 * International Phonetic Alphabet (IPA)
 * Khmer (Cambodian)
 * Kannada
 * Lao
 * Latin


 * Malayalam
 * Mongolian
 * Myanmar (Burmese)
 * Oriya
 * Syriac
 * Tamil
 * Thai
 * Tibetan
 * Tifinagh
 * Yi
 * Zhuyin (Bopomofo)

Unicode has added further scripts and will cover even more, including historic scripts less commonly used as well as extinct ones for academic purposes:


 * Cuneiform
 * Linear B
 * Old Italic (Etruscan)
 * Phoenician
 * Runic
 * Ugaritic

There are no immediate plans to incorporate Egyptian or Mayan hieroglyphs.

Further additions of characters to the already-encoded scripts, as well as symbols, in particular for mathematics and music (in the form of notes and rhythmic symbols), also occur. The Unicode Roadmap lists scripts not yet in Unicode with tentative assignments to code blocks. Invented scripts, most of which do not qualify for inclusion in Unicode due to lack of real-world usage, are listed in the ConScript Unicode Registry, along with unofficial but widely-used Private Use Area code assignments. Similarly, many medieval letter variants and ligatures not in Unicode are encoded in the Medieval Unicode Font Initiative.

Trivia
In 1997 Michael Everson made a proposal to encode the characters of the fictional Klingon language in Plane 1 of ISO/IEC 10646-2. The Unicode Consortium rejected this proposal in 2001 as "inappropriate for encoding" — not because of any technical inadequacy, but because users of Klingon normally read, write and exchange data in Latin transliteration. Now that some enthusiasts are blogging in tlhIngan pIqaD (Klingon alphabet) using newly available fonts and keyboard layouts, the possibility of reapplying to ISO has been raised.

Proposals suggested the inclusion of the elvish scripts Tengwar and Cirth from J. R. R. Tolkien's fictional Middle-earth setting in Plane 1 in 1993. The Consortium withdrew the draft to incorporate changes suggested by Tolkienists, and as of 2005 it remains under consideration.

Both Klingon and the Tolkien scripts have assignments in the ConScript Unicode Registry.

Standard
The Unicode Consortium, based in California, develops the Unicode standard. Any company or individual willing to pay the membership dues may join this organization. Members include virtually all of the main computer software and hardware companies with any interest in text-processing standards, such as Apple Computer, Microsoft, IBM, Xerox, HP, Adobe Systems and many others.

The Consortium first published The Unicode Standard (ISBN 0321185781) in 1991, and continues to develop standards based on that original work. Unicode developed in conjunction with the International Organization for Standardization, and it shares its character repertoire with ISO/IEC 10646. Unicode and ISO/IEC 10646 function equivalently as character encodings, but The Unicode Standard contains much more information for implementers, covering — in depth — topics such as bitwise encoding, collation, and rendering. The Unicode Standard enumerates a multitude of character properties, including those needed for supporting bidirectional text. The two standards do use slightly different terminology.

When writing about a Unicode character, it is normal to write "U+" followed by a hexadecimal number indicating the character's code point. For code points in the BMP, four digits are used; for code points outside the BMP, five or six digits are used, as required. Older versions of the standard used similar notations, but with slightly different rules. For example, Unicode 3.0 used "U-" followed by eight digits, and allowed "U+" to be used only with exactly four digits in order to indicate a code unit, not a code point.

Unicode revision history

 * 1991 Unicode 1.0
 * 1993 Unicode 1.1
 * 1996 Unicode 2.0
 * 1998 Unicode 2.1
 * 1999 Unicode 3.0 — covered 16-bit UCS Basic Multilingual Plane (BMP) from ISO 10646-1:2000
 * 2001 Unicode 3.1 — introduced Supplemental Planes from ISO 10646-2, providing supplementary characters
 * 2002 Unicode 3.2
 * 2003 Unicode 4.0
 * 2005 Unicode 4.1

Storage, transfer, and processing
So far, Unicode has appeared simply as a means to assign a unique number to each character used in the written languages of the world. The storage of these numbers in text processing comprises another topic; problems result from the fact that much software written in the Western world deals with 8-bit character encodings only, with Unicode support added only slowly in recent years. Similarly, in representing the scripts of Asia, the double-byte character encodings cannot even in principle encode more than 65,536 characters, and in practice the architectures chosen impose much lower limits. Such limits do not suffice for the needs of scholars of the Chinese language alone.

The internal logic of much 8-bit legacy software typically permits only 8 bits for each character, making it impossible to use more than 256 code points without special processing. Sixteen-bit software can support only some tens of thousands of characters. Unicode, on the other hand, has already defined more than 90,000 encoded characters. Systems designers have therefore suggested several mechanisms for implementing Unicode; which one implementers choose depends on available storage space, source code compatibility, and interoperability with other systems.

Unicode defines two mapping methods:
 * the UTF (Unicode Transformation Format) encodings
 * the UCS (Universal Character Set) encodings

The encodings include:
 * UTF-7 — a relatively unpopular 7-bit encoding, often considered obsolete
 * UTF-8 — an 8-bit, variable-width encoding
 * UCS-2 — a 16-bit, fixed-width encoding that only supports the BMP
 * UTF-16 — a 16-bit, variable-width encoding
 * UCS-4 and UTF-32 — functionally identical 32-bit fixed-width encodings
 * UTF-EBCDIC — an unpopular encoding intended for EBCDIC based mainframe systems

The numbers in the names of the encodings indicate the number of bits in one code value (for UTF encodings) or the number of bytes per code value (for UCS) encodings.

In UTF-32 and UCS-4, one 32-bit code value serves as a fairly direct representation of any character's code point (although the endianness, which varies across different platforms, affects how the code value actually manifests as a bit sequence). In the other cases, each code point may be represented by a variable number of code values.

UTF-8 uses one to four bytes per code point and, being relatively compact (for Latin script) and ASCII-compatible, provides the de facto standard encoding for interchange of Unicode text. It is also used by most recent Linux distributions as a direct replacement for legacy encodings in general text handling.

UTF-16, meanwhile, which is usually 16 bits per code point — the same as UCS-2 — but sometimes 32, is used by many APIs. Most of this is for historical reasons (they date from the days when Unicode was UCS-2 based or interface with other APIs that use UTF-16). UTF-16 is the standard format for the Windows API (though surrogate support is not enabled by default) and for the Java and .NET bytecode environments.

UCS-2 is an obsolete, 16-bit fixed-width encoding covering the Basic Multilinugual Plane only. For characters in the Basic Multilingual Plane UCS-2 and UTF-16 are identical. Therefore they can be considered as different implementation levels of the same encoding.

UCS-4 and UTF-32 are not commonly used, since no more than 21 of the 32 bits allocated per code point would ever be used, but it is becoming increasingly common for programming language implementations to use UCS-4 for their internal storage of encoded text.

The UCS-2 and UTF-16 encodings specify the Unicode Byte Order Mark (BOM) for use at the beginnings of text files. Some software developers have adopted it for other encodings, including UTF-8, which does not need an indication of byte order. In this case it attempts to mark the file as containing Unicode text. The BOM, code point U+FEFF has the important property of unambiguity, regardless of the Unicode encoding used. The units  and   never appear in UTF-8; U+FFFE (the result of byte-swapping U+FEFF) does not equate to a legal character, and U+FEFF conveys the zero-width no-break space (a character with no appearance and no effect other than preventing the formation of ligatures). The same character converted to UTF-8 becomes the byte sequence.

GB18030 is another encoding form for Unicode, but from the Standardization Administration of China.


 * See also: Mapping of Unicode characters

Ready-made versus composite characters
Unicode includes a mechanism for modifying character shape and so greatly extending the supported glyph repertoire. This covers the use of combining diacritical marks. They get inserted after the main character (one can stack several combining diacritics over the same character). However, for reasons of compatibility, Unicode also includes a large quantity of pre-composed characters. So in many cases, users have many ways of encoding the same character. To deal with this, Unicode provides the mechanism of canonical equivalence.

A similar situation exists with Hangul. Unicode provides the mechanism for composing Hangul syllables with Hangul Jamo. However, it also provides the precomposed Hangul syllables (11,172 of them).

The CJK ideographs currently have codes only for their precomposed form. Still, most of those ideographs evidently comprise simpler elements (radicals), so in principle Unicode could decompose them just as happens with Hangul. This would greatly reduce the number of required code points, while allowing the display of virtually every conceivable ideograph (which might do away with some of the problems caused by the Han unification). A similar idea covers some input methods, such as Cangjie and Wubi. However, attempts to do this for character encoding have stumbled over the fact that ideographs do not actually decompose as simply or as regularly as it seems they should.

A set of radicals was provided in Unicode 3.0 (CJK radicals between U+2E80 and U+2EFF, KangXi radicals in U+2F00 to U+2FDF, and ideographic description characters from U+2FF0 to U+2FFB), but the Unicode standard (ch. 11.1 of Unicode 4.1) warns against using ideographic description sequences as an alternate representation for previously encoded characters:

This process is different from a formal encoding of an ideograph. There is no canonical description of unencoded ideographs; there is no semantic assigned to described ideographs; there is no equivalence defined for described ideographs. Conceptually, ideograph descriptions are more akin to the English phrase, “an ‘e’ with an acute accent on it,” than to the character sequence &lt;U+006E, U+0301&gt;.

Combining marks, like the complex script-shaping required to properly render Arabic text and many other scripts, usually depend on complex font technologies, like OpenType (by Adobe and Microsoft), Graphite (by SIL International), and AAT (by Apple), by which a font designer includes instructions in a font, telling software how to properly output different character sequences. Fixed-width fonts sometimes employ another method: placing the combining mark's glyph before its own left sidebearing; this method, however, works only for some diacritics, and they will not stack properly.

As of 2004, most software still cannot reliably handle many features not supported by older font formats, so combining characters generally will not work correctly. Theoretically, (precomposed e with macron and acute above) and  (e followed by the combining macron above and combining acute above) have an identical appearance, both giving an e with macron and acute accent, but in practice, their appearances can vary greatly across software applications.

Also underdots, as needed in Indic Romanization, will often be placed incorrectly. Sample:

Of course, such problems in fact show not a weakness in Unicode itself, but only uncover weaknesses in rendering technology and fonts. Also note the existence of precomposed glyphs for many accented characters, e.g..

Issues
Some people, mostly in Japan, oppose Unicode in general, claiming technical limitations and political problems in process. People working on the Unicode standard regard such claims simply as misunderstandings of the Unicode standard and of the process by which it has evolved. The most common mistake, according to this view, involves confusion between abstract characters and their highly-variable visual forms (glyphs). On the other hand, whereas Chinese can readily read most types of glyphs used by Japanese or Koreans, Japanese often can recognize only a particular variant.

Some have decried Unicode as a plot against Asian cultures perpetrated by Westerners with no understanding of the characters as used in Chinese, Korean, and Japanese, in spite of the presence of a majority of experts from all three countries in the Ideographic Rapporteur Group (IRG). The IRG advises the consortium and ISO on additions to the repertoire and on Han unification, the identification of forms in the three languages which one can treat as stylistic variations of the same historical character. Han unification has become one of the most controversial aspects of Unicode.

Unicode is criticized for failing to allow for older and alternate forms of kanji, which, it is said, complicates the processing of ancient Japanese and uncommon Japanese names, although it follows the recommendations of Japanese scholars of the language and of the Japanese government. There have been several attempts to create an alternative to Unicode. Among them are TRON (although it is not widely adopted in Japan, some, particularly those who need to handle historical Japanese text, favor this), and UTF-2000. It is true that many older forms were not included in early versions of the Unicode standard, but Unicode 4.0 contains more than 90,000 Han characters, far more than any dictionary or any other standard, and work continues on adding characters from the early literature of China, Korea, and Japan.

Thai language support has been criticized for its illogical ordering of Thai characters. This complication is due to Unicode inheriting the Thai Industrial Standard 620, which worked in the same way. This ordering problem complicates the Unicode collation process. 

Opponents of Unicode sometimes claim even now that it cannot handle more than 65,535 characters, a limitation that was removed in Unicode 2.0.

On the other hand, a few governments, like the Government of India, have shown keen interest in unicode and GoI is a voting member of the unicode consortium.

Operating systems
Unicode has become the dominant scheme for internal processing and sometimes storage (though a lot of text is still stored in legacy encodings) of text. Early adopters tended to use UCS-2 and later moved to UTF-16 (as this was the least disruptive way to add support for non-bmp characters). The best known such system is Windows NT (and its descendants Windows 2000 and Windows XP). The java and .net bytecode environments also use it.

UTF-8 (original developed for Plan 9) has become the main encoding on most Unix-like operating systems (though others are also used by some libraries) due to the fact it is a relatively easy replacement for traditional extended ascii character sets.

E-mail
MIME defines two different mechanisms for encoding non-ASCII characters in e-mail, depending on whether the characters are in e-mail headers such as the "Subject:" or in the text body of the message. In both cases, the original character set is identified as well as a transfer encoding. For e-mail transmission of Unicode the UTF-8 character set and the Base64 transfer encoding are recommended. The details of the two different mechanisms are specified in the MIME standards and are generally hidden from users of e-mail software.

The adoption of Unicode in e-mail has been very slow. Most East-Asian text is still encoded in a local encoding such as Shift-JIS, and many commonly used e-mail programs still cannot handle Unicode data correctly, if they have any support at all. This situation is not expected to change in the foreseeable future.

Web
Recent web browsers display web pages using Unicode if an appropriate font is installed (see Unicode and HTML).

Although syntax rules may affect the order in which characters are allowed to appear, both HTML 4.0 and XML 1.0 documents, by definition, comprise characters from most of the Unicode code points, with the exception of: These characters manifest either directly as bytes according to document's encoding, if the encoding supports them, or users may write them as numeric character references based on the character's Unicode code point, as long as the document's encoding supports the digits and symbols required to write the references (all encodings approved for use on the Internet do). For example, the references,  ,  ,  ,  ,  ,  ,  , and   (or the same numeric values expressed in hexadecimal, with   as the prefix) display on browsers as &#916;, &#1049;, &#1511;,&#8206; &#1605;, &#3671;, &#12354;, &#21494;, &#33865; and &#45307;— if the proper fonts exist, these symbols look like the Greek capital letter "Delta", Cyrillic capital letter "Short I", Hebrew letter "Qof", Arabic letter "Meem", Thai numeral 7, Japanese Hiragana "A", simplified Chinese "Leaf", traditional Chinese "Leaf", and Korean Hangul syllable "Nyaelh", respectively.
 * many of the C0 and C1 control codes.
 * the permanently-unassigned code points D800–DFFF
 * any code point ending in FFFE or FFFF
 * any code point above 10FFFF.

Fonts
Free and retail fonts based on Unicode occur commonly, since first TrueType and now OpenType support Unicode. These font formats map Unicode code points to glyphs.

Thousands of fonts exist on the market, but fewer than a dozen fonts — sometimes described as "pan-Unicode" fonts — attempt to support the majority of Unicode's character repertoire. Instead, Unicode-based fonts typically focus on supporting only basic ASCII and particular scripts or sets of characters or symbols. Several reasons justify this approach: applications and documents rarely need to render characters from more than one or two writing systems; fonts tend to demand resources in computing environments; and operating systems and applications show increasing intelligence in regard to obtaining glyph information from separate font files as needed. Furthermore, designing a consistent set of rendering instructions for tens of thousands of glyphs constitutes a monumental task; such a venture passes the point of diminishing returns for most typefaces.

Several subsets of Unicode are standardized: Microsoft Windows since Windows NT 4.0 supports WGL-4 with 652 characters, which is considered to support all Latin, Greek and Cyrillic-based languages. Other standardized subsets of Unicode include MES-1 (335 characters) and MES-2 (1062 characters) (CWA 13873:2000, Multilingual European Subsets in ISO/IEC 10646-1).

Rendering software which cannot process a Unicode character appropriately most often display it as only an open rectangle, or the Unicode "Replacement Character" (U+FFFD, &#xFFFD;), to indicate the position of the unrecognized character. Some systems have made attempts to provide more information about such characters. The Apple LastResort font will display a substitute glyph indicating the Unicode range of the character and the SIL Unicode fallback font will display a box showing the hexadecimal scalar value of the character.

Multilingual text-rendering engines

 * Uniscribe - Windows
 * Apple Type Services for Unicode Imaging - new engine for Macintosh
 * WorldScript - old engine for Macintosh
 * Pango - Open Source, used by GTK+ (and hence GNOME)
 * ICU Layout Engine - Open Source
 * Graphite - (Open Source renderer from SIL)
 * Scribe - Open Source renderer from Trolltech

Input methods
Because keyboard layouts cannot have simple key combinations for all characters, several operating systems provide alternative input methods that allow access to the entire repetoire.

In Microsoft Windows (since Windows 2000), the "Character Map" program (Start/Programs/Accessories/System Tools/Character Map) provides rich-text editing controls for all Table I characters up to U+FFFF, by selection from a drop-down table, assuming that a Unicode font is selected. Programs such as Microsoft Word have a similar control embedded (Insert/Symbol). Rather more painfully and where the code point of the desired character is known, it is possible to create Unicode characters by pressing, where # represents 0 followed by the decimal code point; for example,   will produce the Unicode character ŋ. (The # must start with 0 to be considered a Unicode code point and the keys on the numeric pad of the keyboard must be used.) This also works in many other Windows applications, but not in applications that use the standard Windows edit control, and do not make any special provisions to allow this type of input. See Alt codes. To add Unicode characters to chart titles in Microsoft Excel first type the title text into a worksheet cell, where the (Insert/Symbol) control can be used. The resulting text can be cut and pasted into chart titles.

Apple Macintosh users have a similar feature with an input method called 'Unicode Hex Input', in Mac OS X and in Mac OS 8.5 and later: hold down the Option key, and type the four-hex-digit Unicode code point. Inputting code points above U+FFFF is done by entering surrogate pairs; the software will convert each pair into a single character automatically. Mac OS X (version 10.2 and newer) also has a 'Character Palette', which allows users to visually select any Unicode character from a table organized numerically, by Unicode block, or by a selected font's available characters. The 'Unicode Hex Input' method must be activated in the International System Preferences in Mac OS X or the 'Keyboard' Control Panel in Mac OS 8.5 and later. Once activated, 'Unicode Hex Input' must also be selected in the Keyboard menu (designated by the flag icon) before a Unicode code point can be entered.

GNOME provides a 'Character Map' utility (Applications/Accessories/Character Map) which displays characters ordered by Unicode block or by writing system, and allows searching by character name or extended description. Where the character's code point is known, it can be entered in accordance with ISO 14755: hold down Ctrl and Shift and enter the hexadecimal Unicode value.

At the X Input Method or GTK+ Input Module level, the input method editor SCIM provides a “raw code” input method to allow the user to enter the 4-digit hexadecimal Unicode value.

All X Window applications (including GNOME and KDE, but not only them) support using Compose Key. And for keyboards which doesn't contain Compose key natively, any key (e.g., CapsLock) could be redefined as Compose key.

The Linux console allows Unicode characters to be entered by holding down Alt and typing the decimal code on the numeric keypad. (In order for this to work, the console should be placed in Unicode mode with  and a suitable font selected with  .)

The Opera web browser in version 7.5 and over allows users to enter any Unicode character directly into a text field by typing its hexadecimal code, selecting it, and pressing.

In the Vim text editor, Unicode characters can be entered by pressing CTRL-V and then entering a key combination. For more information, type " " in Vim. (Note that the entered text will be Unicode only if the current encoding is set to Unicode or a related format like UTF-8; type " " in Vim for details.) Many Unicode characters can also be entered using digraphs; a table of such characters and their corresponding digraphs can be obtained using the " " command (again provided the current encoding is set to Unicode).

WordPad and Word 2002/2003 for Windows additionally allow for entering Unicode characters by typing the hexadecimal code point, for example 014B for ŋ, and then pressing  to substitute the string to the left by its Unicode character. Usefully, the reverse also applies: if a user positions a cursor to the right of a non-ASCII character and presses, then the Microsoft software will substitute the character with the hexadecimal Unicode code point.

Several visual keyboards are available that make entering Unicode characters and symbols very easy.
 * Quick Key (Open Source)
 * PopChar Demo Version