Alt_code

Alt code

Alt code

Method for entering characters into a computer


On personal computers with numeric keypads that use Microsoft operating systems, such as Windows, many characters that do not have a dedicated key combination on the keyboard may nevertheless be entered using the Alt code (the Alt numpad input method). This is done by pressing and holding the Alt key, then typing a number on the keyboard's numeric keypad that identifies the character and then releasing Alt.[1]

History and description

MS DOS

On IBM PC compatible personal computers from the 1980s, the BIOS allowed the user to hold down the Alt key and type a decimal number on the keypad. It would place the corresponding code into the keyboard buffer so that it would look (almost) as if the code had been entered by a single keystroke. Applications reading keystrokes from the BIOS would behave according to what action they associate with that code. Some would interpret the code as a command, but often it would be interpreted as an 8-bit character from the current code page that was inserted into the text the user was typing. On the original IBM PC the code page was CP437.

Some Eastern European, Arabic and Asian computers used other hardware code pages, and MS-DOS was able to switch between them at runtime with commands like KEYB, CHCP or MODE. This causes the Alt combinations to produce different characters (as well as changing the display of any previously-entered text in the same manner). A common choice in locales using variants of the Latin alphabet was CP850, which provided more Latin character variants. (There were, however, many more code pages; for a more complete list, see code page).

PC keyboards designed for non-English use included other methods of inserting these characters, such as national keyboard layouts, the AltGr key or dead keys, but the Alt key was the only method of inserting some characters, and the only method that was the same on all machines, so it remained very popular.[where?][clarification needed] This input method is emulated by many pieces of software (such as later versions of MS-DOS and Windows) that do not use the BIOS keyboard decoding.

In the ASCII standard, the numbers 0-31 and 127 are assigned to control characters, for instance, code point 7 is typed by Ctrl+G. While some (most?) applications would insert a bullet character (code point 7 on code page 437), some would treat this identical to Ctrl+G which often was a command for the program.[citation needed]

Typing a number greater than 255 produced the character associated with the remainder after the number is divided by 256.[citation needed]

Windows

The Alt codes had become so well known and memorized by users that Microsoft decided to preserve them, even though it used a new and different set of code pages for Windows, such as CP1252. The old code pages were called OEM code pages; the new ones are called Windows code pages,[lower-alpha 1] The familiar Alt+number combinations produced codes from the OEM code page (for example, CP437 in the United States), matching the results from MS-DOS. But prefixing a leading zero (0) to the number (usually meaning 4 digits) produced the character specified by the newer Windows code page,[lower-alpha 2] allowing them to be typed as well.

For instance, the combination Alt+163 would result in ú (Latin letter u with acute accent) which is at 163 in the OEM code page of CP437 or CP850, while Alt+0163 yields the character £ (symbol for the pound sterling) which is at 163 in CP1252.[2]

The numbers 0 –31 and 127 are control characters in the Windows code pages. Typing these numbers with a leading zero is ignored.[citation needed]

Before Unicode was introduced, most Windows software could only create text using the repertoire of characters available in a single Windows code page. Characters that did not exist in that page (such as a line-drawing graphic from the OEM page) could not be inserted, and either were ignored or produced an unexpected character.[citation needed]

Transition to Unicode

When Windows later transitioned to Unicode,[when?] all the characters from both the OEM and Windows code pages were available, actually improving the emulation of the oldest MSDOS Alt codes.

There was a desire to extend the Alt codes to allow entry of any Unicode code point. Numbers greater or equal to 256 pick the corresponding Unicode code point (lower numbers continue to pick characters from the OEM or ANSI code pages, but if 0 is prefixed the ANSI code page greatly resembles the first 256 characters of Unicode). Some applications (RichEdit-based) like Word 2010, Wordpad, and PSPad operate this way.[3] Other Windows applications, including Notepad, Chrome, Firefox, and Microsoft Edge interpret all numbers greater than 255 modulo 256.[citation needed]

Because most Unicode documentation and the Character Map accessory show the code points in hex, not decimal, a variation of Alt codes was developed to allow the typing of numbers in hex (using the main keyboard for AF). To enable it, a user must set or create a string type (REG_SZ) value called EnableHexNumpad in the registry key HKEY_CURRENT_USER\Control Panel\Input Method, assign the value data 1 to it, and then reboot or log out/in.[citation needed] A leading + then indicates hex input, for example Alt++11B will produce ě (e with caron).

Problems

If Num lock is disabled, attempting an Alt code may cause unexpected results in some applications, due to the controls used on the same key. For example, Alt+4 can be taken as Alt+, causing a web browser to go back one page.

Many laptops do not have a separate numeric keypad, but some may provide numpad input by holding a modifier key (typically labelled "Fn"); thus one must press and hold both Alt and Fn keys while entering the character code.

One limitation of the Alt code feature is that the Alt key and the numpad keys being used to enter the code must both be on the same keyboard device. Users with keyboards that lack a numpad (e.g. tenkeyless designs) cannot use a separate numpad device to enter Alt codes while holding the Alt key on their main keyboard.[citation needed]

Other operating systems

The Alt key method does not work on ChromeOS, macOS, Linux or other operating systems and there is no readily-accessible evidence of interest in replicating it, due to its including the 1980s IBM PC character encoding as part of its definition. However, numeric entry of Unicode characters is possible in most Unix or Unix-like OSs by typing Ctrl+⇧ Shift+U, (release) then the hex number, then the space bar or enter key. For example,

Alternatives

Alternative systems exist for users to make characters without selecting them by number, for example using a popup window that lets a user choose the desired character by clicking on it. Examples include the Windows Character Map or the Insert Character facility in MsOffice. See Unicode input for more.

List of codes

More information Unicode, CP437 ...

See also

Notes

  1. Initially these were called "ANSI" code pages, but Microsoft has acknowledged that this was a misnomer.
  2. Simplifying a bit by not taking 16-bit DBCS code pages into account here.
  3. Only visible at a line break that falls between syllables of a word, where it appears as a hyphen-minus, -.

References

  1. "Alt Codes List of Alt Key Codes Symbols". www.alt-codes.net. Retrieved 2022-02-23.
  2. "To input characters that are not on your keyboard". Microsoft. 2016-07-22. Archived from the original on 2016-07-22. Retrieved 2022-12-30.
  3. "About Rich Edit Controls - Win32 apps". learn.microsoft.com. Retrieved 2022-12-30.

Share this article:

This article uses material from the Wikipedia article Alt_code, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.