Unicode input

From Wikipedia, the free encyclopedia
Jump to: navigation, search
The Unicode logo

Unicode input is the insertion of a specific Unicode character on a computer by a user. Unicode characters can be inserted in three ways: from the screen by means of an applet from which one can select the character, by pasting from the clipboard or by certain key sequence on the keyboard. Unicode is similar to ASCII, but provides many more options and can store more signs.[1]

A Unicode input system needs to provide a large repertoire of characters, ideally all valid Unicode code points. This is different from a keyboard layout which defines keys and their combinations only for a limited number of characters appropriate for a certain locale.

Unicode numbers[edit]

Unicode characters are distinguished by code points, which are conventionally represented by the letter U followed by four or five hexadecimal digits, for example U+00AE or U+1D310. Characters in the Basic Multilingual Plane (BMP), containing modern scripts – including many Chinese and Japanese characters – and many symbols, have a 4-digit code. Historic scripts, but also many modern symbols and pictographs (such as emoticons, playing cards and many CJK characters) have 5-digit codes.

Decimal input[edit]

In some applications on Microsoft Windows, particularly those using the RichEdit control, decimal Unicode code points (for example, 256 for U+0100) are supported with Alt codes.

Unicode in HTML[edit]

HTML uses a different syntax for code points. Character codes may be specified after ampersand (&) and the number sign (#), and are followed by the semicolon (;). The number can be either in decimal or in hexadecimal. Preceding zeros may be omitted. If the input is in hexadecimal, the number is preceded by an "x". Some characters can also be used by "entity name".
Example: The HTML code of the copyright sign U+00A9 (or ©) can be:
© (decimal input)
© (hexadecimal input)
© (entity name)

Availability[edit]

For displaying a Unicode character, it must be present in the chosen font.[2] Different fonts have different glyphs for the same Unicode, thus the appearance of the character will depend on the font which is defined in the web browser or application. Also, not every Unicode is available in every font. The availability of a specific character depends on its presence in the specified font; every font has its own number of characters, or even none at all. Most characters will not be available. If a desired character is not present in the available fonts, a suitable font should be installed on the system. The character can be displayed on the system now, but if it is a more or less exotic one, it will not be visible on many other systems. An empty box, a question mark or another replacement will be shown: �.

Older web browsers can only display text supported by the current font associated with the character encoding of the page. Some modern browsers, such as Mozilla Firefox, Opera, Safari and Internet Explorer (version ≥ 7), are able to display multilingual web pages by intelligently choosing a font to display each individual character on the page. They will correctly display any mix of Unicode blocks, as long as appropriate fonts are present in the operating system. After installation of a missing font the browser will find the correct Unicode character automatically after restart.

Selection from a screen[edit]

Applet for character selection

Many systems provide a way to select Unicode characters visually. ISO 14755 refers to this as a screen-selection entry method.

Microsoft Windows has provided a Unicode version of the Character Map program (find it by hitting Win+R then type charmap then hit Enter) since version NT 4.0 – appearing in the consumer edition since XP. This is limited to characters in the Basic Multilingual Plane (BMP). Characters are searchable by Unicode character name, and the table can be limited to a particular code block.

Mac OS X provides a "character palette" with much the same functionality, along with searching by related characters, glyph tables in a font, etc. It can be enabled in the input menu in the menu bar under System Preferences → International → Input Menu (or System Preferences → Language and Text → Input Sources) or can be viewed under Edit → Special Characters... while Finder is in the foreground.

Equivalent tools – such as gucharmap (GNOME) or kcharselect (KDE) – exist on most Linux desktop environments.

Hexadecimal code input[edit]

Different glyphs of Unicode U+0061.

Clause 5.1 of ISO 14755 describes a Basic method whereby a beginning sequence is followed by the hex number representation of the code point and the ending sequence. On some systems, this is limited to the BMP (characters up to U+FFFF).

In Microsoft Windows[edit]

A prerequisite for this input method is, that the registry key HKEY_CURRENT_USER\Control Panel\Input Method contains a string type (REG_SZ) value called EnableHexNumpad, which has the value data 1. Users need to log off/in on Windows 7 and Vista or reboot on earlier systems after editing the registry for this input method to start working. Unicode characters can be entered by holding down Alt, pressing the + on the numeric keypad, followed by the hex code - using the numeric keypad for digits from 0 to 9 and letter keys for A to F digits - and then releasing Alt.[2]

The RichEdit control on Microsoft Windows (as used in for example WordPad) supports the following input method: one first enters the character’s hexadecimal code (between two and six hexadecimal digits), then immediately presses Alt+x. For example, entering f1 and then pressing the combination will produce the character ñ. Unless it is six hexadecimal digits long, the code must not be preceded by any digit or letters a–f as they will be treated as part of the code to be converted. For example, entering af1 followed by Alt+x will produce ૱ (U+0AF1), but entering a0000f1 followed by Alt+x will produce . This also works in Microsoft Word 2002/2003 for Windows.

In Mac OS[edit]

In Mac OS X the "Special Characters…" ( Command+ Option+T) menu can be found in the Edit menu in many programs. This brings up the Characters palette allowing the user to choose any character from a variety of views. The user can then also search for the character or Unicode plane by name.[3] In Mac OS 8.5 and later: one chooses the Unicode Hex Input keyboard layout. Holding down the Option, one then types the four-digit hex Unicode code point and the equivalent character appears. One can then release the Option key.[4] Characters outside of the BMP exceed the four-digit limit of the Unicode hex input mechanism but can be entered using the search entry box in the Character Viewer (Edit → Special Characters…) or by using surrogate pairs.[5] To use surrogate pairs, hold down the Option key, the first surrogate, the + key (shift key is ignored), the second surrogate and then release the Option key.

In X11 (Linux and other Unix variants)[edit]

The possibility of hexadecimal code input on operating systems using the X Window System depends on the system and applications. Hex input is not implemented in the common X.Org Server.[6] Individual input methods and GUI toolkits can provide hex input independent of the X server.

For example, GTK+ is an ISO 14755-conformant system. The beginning sequence is Ctrl+ Shift+U and the ending sequence is Enter or Space. Programs based on GTK+, such as GNOME applications, support Unicode input.

There are two common methods for direct input of Unicode characters:

  • Hold Ctrl+ Shift and type u followed by the four hex digits. Then release Ctrl+ Shift.
  • Enter Ctrl+ Shift+u, release, then type the four hex digits, and press Enter (or Space or even on some systems, press and release Shift or Ctrl ).

In OpenOffice.org and Inkscape, for example, only the second method works.

In non-GTK applications, however, there usually is no escape sequence to input arbitrary input characters. For example, Qt, KDE rely on the standard X Input Method (XIM) framework, and do not implement their own solutions.[7] In xterm, these input methods are not be supported, but using escape sequences is an alternative.

However, regardless of the toolkit used, the Compose key subsystem can be used to configure certain key stroke combinations to input a subset of unicode.

In platform independent applications[edit]

  • In Opera (browser) versions, that use the Presto layout engine - i.e. up to and including version 12.xx -, enter the hexadecimal number of the desired symbol or character and then press Ctrl+ Shift+x (alternative shortcut Meta+ Shift+x on OS X).
  • In the Vim editor, in insert mode, the user first types Ctrl+V u, then types in the hexadecimal number of the symbol or character desired, and it will be converted into the symbol. (On Microsoft Windows, Ctrl+Q may be required instead of Ctrl+V.[8])

The capability of Vim to create custom mnemonics, as described below, which could be employed on an ad-hoc basis, requires the decimal code point.

Character mnemonics[edit]

RFC 1345 defines a large number (1,893) of suggested mnemonics for code points in Unicode 1.0 (as well as characters in ISO 2DIS 10646 and many other character sets in use at the time of publication). Although the document does not restrict the length of a mnemonic (for example, "10000R" for U+2821), most (1,338) of the mnemonics are two characters long, and most (416) of the remaining are three-characters. While never complete, and targeting obsolescent set definitions, the mnemonics themselves can still be used.

  • Vim allows mnemonics entry (confusingly called "digraphs" by Vim developers) in insert mode (the regular mode for typing text) with Ctrl+K followed by a two-keystroke RFC 1345 mnemonic; or, in addition, if the digraph option is set, by entering the first character followed by a backspace followed by the second character. Custom mnemonics can also be defined for arbitrary code points. (For example, "dig Gr 9881" associates "Gr" with U+2699 gear.)
  • GNU Emacs allows mnemonics entry by switching to rfc1345 input mode (by default Ctrl+x Ctrl+\.
  • GNU Screen allows mnemonics entry with (by default) Ctrl+A Ctrl+V.
  • Zsh allows mnemonics entry using the insert-composed-char widget.

RFC 1345 predates the introduction of the Euro sign (€, U+20AC), but the above applications included it as the mnemonic "Eu".

Specialized tools[edit]

There are several tools that allow quick input of Unicode characters in applications. The input method of the free tool ЮNICODE Keyboard Enhancer uses hotkeys: To type a Unicode character you press and hold the modifier key and then press the selected symbol key. Which physical key takes the function of the modifier key as well the appropriated symbol keys are to be defined by user.

Another free tool is UnicodeIt. It converts LaTeX expressions like \alpha into Unicode. On the Mac, this works in most programs (including Keynote and Mail) using a keyboard shortcut. This tool also has an online version at http://www.unicodeit.net which works on most platforms including smart phones.

There is also a free webtool called Shapecatcher that can by used to find Unicode characters by drawing them.

See also[edit]

External links[edit]

References[edit]