Alt code

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]

MS-DOS

[edit]

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]

Windows

[edit]

The Alt codes had become so well known and memorized by users that Microsoft decided to preserve them in Microsoft Windows, even though the OS features a newer and different set of code pages, such as CP1252. Windows includes the following processing algorithm for Alt code, which supports both methods:

  • The familiar Alt+### combination (where ### is from 0 to 255) retains the old MS-DOS behavior, i.e., generates characters from the legacy code pages now called "OEM code pages." 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.[2] This did not work for characters not in the Windows Code Page (such as box-drawing characters).
  • The new Alt+0### combination (which prefixes a zero to each Alt code), produces characters from the newer "Windows code pages."[a] For example, Alt+0163 yields the character £ (symbol for the pound sterling) which is at 163 in CP1252.[2][b]

Unicode

[edit]

Later versions of Windows and applications such as Microsoft Word supported Unicode. As Unicode included all the characters in the MSDOS code pages, this had the immediate benefit that all the old MSDOS Alt combinations worked, not just the ones that existed in the Windows Code Page.

In the IBM PC Bios typing an Alt code greater than 255 produced the same as that number modulo 256.[3] Some applications retained this behavior, while others (in particular applications using the Windows RichEdit control, such as WordPad and PSPad) made numbers from 256 to 65,535 produce the corresponding Unicode character.[4] For instance, Alt+9731 in WordPad produces the U+2603 SNOWMAN. If the Windows Code Page was set to CP1252 then all Unicode characters except control characters could be typed this way.

Alternatives

[edit]

Because most Unicode documentation and character tables 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. A leading + then indicates hex input, for example Alt++11B will produce ě (e with caron).

There are many other ways of typing arbitrary Unicode characters, such as the Character Map utility.

Other operating systems

[edit]

The Alt key method does not work on ChromeOS, macOS, Linux or other operating systems and there is no evidence of interest in replicating it. However, numeric entry of Unicode characters is possible in most Unix or Unix-like OSs by pressing and releasing Ctrl+⇧ Shift+U, and typing the hex number followed by the space bar or enter key. For example,

Limitations

[edit]

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.

List of codes

[edit]
Unicode CP437 CP850 CP1252 Unicode name
  U+00A0 255 0160 NO-BREAK SPACE
¡ U+00A1 173 0161 INVERTED EXCLAMATION MARK
¢ U+00A2 155 189 0162 CENT SIGN
£ U+00A3 156 0163 POUND SIGN
¤ U+00A4 207 0164 CURRENCY SIGN
¥ U+00A5 157 190 0165 YEN SIGN
¦ U+00A6 221 0166 BROKEN BAR
§ U+00A7 21 245 0167 SECTION SIGN
¨ U+00A8 249 0168 DIAERESIS
© U+00A9 184 0169 COPYRIGHT SIGN
ª U+00AA 166 0170 FEMININE ORDINAL INDICATOR
« U+00AB 174 0171 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
¬ U+00AC 170 0172 NOT SIGN
­[c] U+00AD 240 0173 SOFT HYPHEN
® U+00AE 169 0174 REGISTERED SIGN
¯ U+00AF 238 0175 MACRON
° U+00B0 248 0176 DEGREE SIGN
± U+00B1 241 0177 PLUS-MINUS SIGN
2 U+00B2 253 0178 SUPERSCRIPT TWO
3 U+00B3 252 0179 SUPERSCRIPT THREE
´ U+00B4 239 0180 ACUTE ACCENT
μ U+00B5 230 0181 MICRO SIGN
U+00B6 20 244 0182 PILCROW SIGN
· U+00B7 250 0183 MIDDLE DOT
¸ U+00B8 247 0184 CEDILLA
1 U+00B9 251 0185 SUPERSCRIPT ONE
º U+00BA 167 0186 MASCULINE ORDINAL INDICATOR
» U+00BB 175 0187 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
14 U+00BC 172 0188 VULGAR FRACTION ONE QUARTER
12 U+00BD 171 0189 VULGAR FRACTION ONE HALF
34 U+00BE 243 0190 VULGAR FRACTION THREE QUARTERS
¿ U+00BF 168 0191 INVERTED QUESTION MARK
À U+00C0 183 0192 LATIN CAPITAL LETTER A WITH GRAVE
Á U+00C1 181 0193 LATIN CAPITAL LETTER A WITH ACUTE
 U+00C2 182 0194 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
à U+00C3 199 0195 LATIN CAPITAL LETTER A WITH TILDE
Ä U+00C4 142 0196 LATIN CAPITAL LETTER A WITH DIAERESIS
Å U+00C5 143 0197 LATIN CAPITAL LETTER A WITH RING ABOVE
Æ U+00C6 146 0198 LATIN CAPITAL LETTER AE
Ç U+00C7 128 0199 LATIN CAPITAL LETTER C WITH CEDILLA
È U+00C8 212 0200 LATIN CAPITAL LETTER E WITH GRAVE
É U+00C9 144 0201 LATIN CAPITAL LETTER E WITH ACUTE
Ê U+00CA 210 0202 LATIN CAPITAL LETTER E WITH CIRCUMFLEX
Ë U+00CB 211 0203 LATIN CAPITAL LETTER E WITH DIAERESIS
Ì U+00CC 222 0204 LATIN CAPITAL LETTER I WITH GRAVE
Í U+00CD 214 0205 LATIN CAPITAL LETTER I WITH ACUTE
Î U+00CE 215 0206 LATIN CAPITAL LETTER I WITH CIRCUMFLEX
Ï U+00CF 216 0207 LATIN CAPITAL LETTER I WITH DIAERESIS
Ð U+00D0 209 0208 LATIN CAPITAL LETTER ETH
Ñ U+00D1 165 0209 LATIN CAPITAL LETTER N WITH TILDE
Ò U+00D2 227 0210 LATIN CAPITAL LETTER O WITH GRAVE
Ó U+00D3 224 0211 LATIN CAPITAL LETTER O WITH ACUTE
Ô U+00D4 226 0212 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
Õ U+00D5 229 0213 LATIN CAPITAL LETTER O WITH TILDE
Ö U+00D6 153 0214 LATIN CAPITAL LETTER O WITH DIAERESIS
× U+00D7 158 0215 MULTIPLICATION SIGN
Ø U+00D8 157 0216 LATIN CAPITAL LETTER O WITH STROKE
Ù U+00D9 235 0217 LATIN CAPITAL LETTER U WITH GRAVE
Ú U+00DA 233 0218 LATIN CAPITAL LETTER U WITH ACUTE
Û U+00DB 234 0219 LATIN CAPITAL LETTER U WITH CIRCUMFLEX
Ü U+00DC 154 0220 LATIN CAPITAL LETTER U WITH DIAERESIS
Ý U+00DD 237 0221 LATIN CAPITAL LETTER Y WITH ACUTE
Þ U+00DE 232 0222 LATIN CAPITAL LETTER THORN
ß U+00DF 225 0223 LATIN SMALL LETTER SHARP S
à U+00E0 133 0224 LATIN SMALL LETTER A WITH GRAVE
á U+00E1 160 0225 LATIN SMALL LETTER A WITH ACUTE
â U+00E2 131 0226 LATIN SMALL LETTER A WITH CIRCUMFLEX
ã U+00E3 198 0227 LATIN SMALL LETTER A WITH TILDE
ä U+00E4 132 0228 LATIN SMALL LETTER A WITH DIAERESIS
å U+00E5 134 0229 LATIN SMALL LETTER A WITH RING ABOVE
æ U+00E6 145 0230 LATIN SMALL LETTER AE
ç U+00E7 135 0231 LATIN SMALL LETTER C WITH CEDILLA
è U+00E8 138 0232 LATIN SMALL LETTER E WITH GRAVE
é U+00E9 130 0233 LATIN SMALL LETTER E WITH ACUTE
ê U+00EA 136 0234 LATIN SMALL LETTER E WITH CIRCUMFLEX
ë U+00EB 137 0235 LATIN SMALL LETTER E WITH DIAERESIS
ì U+00EC 141 0236 LATIN SMALL LETTER I WITH GRAVE
í U+00ED 161 0237 LATIN SMALL LETTER I WITH ACUTE
î U+00EE 140 0238 LATIN SMALL LETTER I WITH CIRCUMFLEX
ï U+00EF 139 0239 LATIN SMALL LETTER I WITH DIAERESIS
ð U+00F0 208 0240 LATIN SMALL LETTER ETH
ñ U+00F1 164 0241 LATIN SMALL LETTER N WITH TILDE
ò U+00F2 149 0242 LATIN SMALL LETTER O WITH GRAVE
ó U+00F3 162 0243 LATIN SMALL LETTER O WITH ACUTE
ô U+00F4 147 0244 LATIN SMALL LETTER O WITH CIRCUMFLEX
õ U+00F5 228 0245 LATIN SMALL LETTER O WITH TILDE
ö U+00F6 148 0246 LATIN SMALL LETTER O WITH DIAERESIS
÷ U+00F7 246 0247 DIVISION SIGN
ø U+00F8 155 0248 LATIN SMALL LETTER O WITH STROKE
ù U+00F9 151 0249 LATIN SMALL LETTER U WITH GRAVE
ú U+00FA 163 0250 LATIN SMALL LETTER U WITH ACUTE
û U+00FB 150 0251 LATIN SMALL LETTER U WITH CIRCUMFLEX
ü U+00FC 129 0252 LATIN SMALL LETTER U WITH DIAERESIS
ý U+00FD 236 0253 LATIN SMALL LETTER Y WITH ACUTE
þ U+00FE 231 0254 LATIN SMALL LETTER THORN
ÿ U+00FF 152 0255 LATIN SMALL LETTER Y WITH DIAERESIS
ı U+0131 213 LATIN SMALL LETTER DOTLESS I
Œ U+0152 0140 LATIN CAPITAL LIGATURE OE
œ U+0153 0156 LATIN SMALL LIGATURE OE
Š U+0160 0138 LATIN CAPITAL LETTER S WITH CARON
š U+0161 0154 LATIN SMALL LETTER S WITH CARON
Ÿ U+0178 0159 LATIN CAPITAL LETTER Y WITH DIAERESIS
Ž U+017D 0142 LATIN CAPITAL LETTER Z WITH CARON
ž U+017E 0158 LATIN SMALL LETTER Z WITH CARON
ƒ U+0192 159 0131 LATIN SMALL LETTER F WITH HOOK
ˆ U+02C6 0136 MODIFIER LETTER CIRCUMFLEX ACCENT
˜ U+02DC 0152 SMALL TILDE
Γ U+0393 226 GREEK CAPITAL LETTER GAMMA
Θ U+0398 233 GREEK CAPITAL LETTER THETA
Σ U+03A3 228 GREEK CAPITAL LETTER SIGMA
Φ U+03A6 232 GREEK CAPITAL LETTER PHI
Ω U+03A9 234 GREEK CAPITAL LETTER OMEGA
α U+03B1 224 GREEK SMALL LETTER ALPHA
δ U+03B4 235 GREEK SMALL LETTER DELTA
ε U+03B5 238 GREEK SMALL LETTER EPSILON
π U+03C0 227 GREEK SMALL LETTER PI
σ U+03C3 229 GREEK SMALL LETTER SIGMA
τ U+03C4 231 GREEK SMALL LETTER TAU
φ U+03C6 237 GREEK SMALL LETTER PHI
U+2013 0150 EN DASH
U+2014 0151 EM DASH
U+2017 242 DOUBLE LOW LINE
U+2018 0145 LEFT SINGLE QUOTATION MARK
U+2019 0146 RIGHT SINGLE QUOTATION MARK
U+201A 0130 SINGLE LOW-9 QUOTATION MARK
U+201C 0147 LEFT DOUBLE QUOTATION MARK
U+201D 0148 RIGHT DOUBLE QUOTATION MARK
U+201E 0132 DOUBLE LOW-9 QUOTATION MARK
U+2020 0134 DAGGER
U+2021 0135 DOUBLE DAGGER
U+2022 7 0149 BULLET
... U+2026 0133 HORIZONTAL ELLIPSIS
U+2030 0137 PER MILLE SIGN
U+2039 0139 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
U+203A 0155 SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
U+203C 19 DOUBLE EXCLAMATION MARK
n U+207F 252 SUPERSCRIPT LATIN SMALL LETTER N
U+20A7 158 PESETA SIGN
U+20AC 0128 EURO SIGN
U+2122 0153 TRADE MARK SIGN
U+2190 27 LEFTWARDS ARROW
U+2191 24 UPWARDS ARROW
U+2192 26 RIGHTWARDS ARROW
U+2193 25 DOWNWARDS ARROW
U+2194 29 LEFT RIGHT ARROW
U+2195 18 UP DOWN ARROW
U+21A8 23 UP DOWN ARROW WITH BASE
U+2219 249 BULLET OPERATOR
U+221A 251 SQUARE ROOT
U+221E 236 INFINITY
U+221F 28 RIGHT ANGLE
U+2229 239 INTERSECTION
U+2248 247 ALMOST EQUAL TO
U+2264 243 LESS-THAN OR EQUAL TO
U+2261 240 IDENTICAL TO
U+2265 242 GREATER-THAN OR EQUAL TO
U+2302 127 HOUSE
U+2310 169 REVERSED NOT SIGN
U+2320 244 TOP HALF INTEGRAL
U+2321 245 BOTTOM HALF INTEGRAL
U+2500 196 BOX DRAWINGS LIGHT HORIZONTAL
U+2502 179 BOX DRAWINGS LIGHT VERTICAL
U+250C 218 BOX DRAWINGS LIGHT DOWN AND RIGHT
U+2510 191 BOX DRAWINGS LIGHT DOWN AND LEFT
U+2514 192 BOX DRAWINGS LIGHT UP AND RIGHT
U+2518 217 BOX DRAWINGS LIGHT UP AND LEFT
U+251C 195 BOX DRAWINGS LIGHT VERTICAL AND RIGHT
U+2524 180 BOX DRAWINGS LIGHT VERTICAL AND LEFT
U+252C 194 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
U+2534 193 BOX DRAWINGS LIGHT UP AND HORIZONTAL
U+253C 197 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
U+2550 205 BOX DRAWINGS DOUBLE HORIZONTAL
U+2551 186 BOX DRAWINGS DOUBLE VERTICAL
U+2552 213 BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
U+2553 214 BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
U+2554 201 BOX DRAWINGS DOUBLE DOWN AND RIGHT
U+2555 184 BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
U+2556 183 BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
U+2557 187 BOX DRAWINGS DOUBLE DOWN AND LEFT
U+2558 212 BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
U+2559 211 BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
U+255A 200 BOX DRAWINGS DOUBLE UP AND RIGHT
U+255B 190 BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
U+255C 189 BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
U+255D 188 BOX DRAWINGS DOUBLE UP AND LEFT
U+255E 198 BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
U+255F 199 BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
U+2560 204 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
U+2562 182 BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
U+2563 185 BOX DRAWINGS DOUBLE VERTICAL AND LEFT
U+2564 209 BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
U+2565 210 BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
U+2566 203 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
U+2567 207 BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
U+2568 208 BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
U+2569 202 BOX DRAWINGS DOUBLE UP AND HORIZONTAL
U+256A 216 BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
U+256B 215 BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
U+256C 206 BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
U+2580 223 UPPER HALF BLOCK
U+2584 220 LOWER HALF BLOCK
U+2588 219 FULL BLOCK
U+258C 221 LEFT HALF BLOCK
U+2590 222 RIGHT HALF BLOCK
U+2591 176 LIGHT SHADE
U+2592 177 MEDIUM SHADE
U+2593 178 DARK SHADE
U+25A0 254 BLACK SQUARE
U+25AC 22 BLACK RECTANGLE
U+25B2 30 BLACK UP-POINTING TRIANGLE
U+25BA 16 BLACK RIGHT-POINTING POINTER
U+25BC 31 BLACK DOWN-POINTING TRIANGLE
U+25C4 17 BLACK LEFT-POINTING POINTER
U+25CB 9 WHITE CIRCLE
U+25D8 8 INVERSE BULLET
U+25D9 10 INVERSE WHITE CIRCLE
U+263A 1 WHITE SMILING FACE
U+263B 2 BLACK SMILING FACE
U+263C 15 WHITE SUN WITH RAYS
U+2640 12 FEMALE SIGN
U+2642 11 MALE SIGN
U+2660 6 BLACK SPADE SUIT
U+2663 5 BLACK CLUB SUIT
U+2665 3 BLACK HEART SUIT
U+2666 4 BLACK DIAMOND SUIT
U+266A 13 EIGHTH NOTE
U+266B 14 BEAMED EIGHTH NOTES

See also

[edit]

Notes

[edit]
  1. ^ Microsoft initially referred to them as "ANSI" code pages, but later acknowledged that this as a misnomer.
  2. ^ But if the user has, for, example, the code page CP1253 (Cyrillic) in use, where the symbol at codepoint 163 is Je (Cyrillic) (Ј), it is this and not £ that will be displayed.
  3. ^ Only visible at a line break that falls between syllables of a word, where it appears as a hyphen-minus, -.

References

[edit]
  1. ^ "Alt Codes List of Alt Key Codes Symbols". www.alt-codes.net. Retrieved 2022-02-23.
  2. ^ a b "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. ^ Chen, Raymond (2 July 2024). "The history of Alt+number sequences, and why Alt+9731 sometimes gives you a heart and sometimes a snowman". The Old New Thing. Microsoft.
  4. ^ Walker, Jim; et al. (27 April 2022). "About Rich Edit Controls". Windows App Development. Microsoft – via Microsoft Learn.