Alt codes and typing any Unicode character
unicodealt-codescp437windows-1252keyboardtext-input
Windows "Alt codes" (hold Alt, type digits on the numeric keypad, release) are three different code tables depending on how you type the number. The Keyboard Android app reproduces the rules exactly, plus a hex mode for anything in Unicode.
The rules
- Decimal 1 to 255 without a leading zero: the IBM PC code page CP437. Alt+3 is ♥, Alt+130 is é. Codes 1 to 31 and 127 are the CP437 graphic symbols (☺ ☻ ♥ ♦ ...), not control characters.
- With a leading zero:
- 0 to 127: ASCII.
- 0128 to 0159: Windows-1252 (0128 is €, 0153 is ™). Five values are undefined in 1252 and produce nothing: 129, 141, 143, 144, 157.
- 0160 to 0255: Latin-1 (0169 is ©).
- Above 255: the number is a Unicode code point (Alt+8364 is €, Alt+128512 is 😀). Classic Windows only does this in some apps; the rule here makes it universal.
- Hex: any code point up to 10FFFF, e.g.
20AC. Word's trick also works: type20acorU+1F600in the text and convert.
What must produce nothing
0, surrogates (D800 to DFFF), anything above 10FFFF, noncharacters, and control characters except Tab and CR/LF (which become a newline). Show why instead of inserting garbage.
Design notes from the Keyboard
- A single tap on Alt arms it for one chord (Alt+1 goes to the app; terminals use it). Alt codes are entered with Alt locked (double tap) or by holding Alt and typing digits, Windows style.
- Committed as text; nothing is learned by the dictionary.