Windows – Which character encoding is used for ALT-codes

alt-codekeyboardunicodewindows

In Windows, when entering characters using ALT+nnn, which character encoding is being used? And when entering characters with ALT+0nnn, which character encoding is being used? And how do these answers depend on Windows' language and input method settings, if at all? And is it always the case that the codes repeat after 255?

I've found multiple websites with information that's confusing, outdated, possibly language-specific or just wrong. And despite this being a well-known and widely-used Windows feature, I can't seem to find any reasonable official documentation on it.

Best Answer

I believe these shortcuts depend on the libraries used by specific programs such as Word, Excel and Notepad. References to Alt character codes at microsoft.com are always in the context of a specific application or suite.

The character resulting from Alt+nnn ought not to depend on any IME but should respect document, application or Windows language settings that determine the default code page currently in use.

Microsoft are cavalier in their use of terms like ASCII and ANSI, documentation of Alt+nnn reflects that.

Here's a little experiment in the Command Prompt on Vista

c:\>chcp 437
Active code page: 437
c:\>rem alt+224 α
c:\>rem alt+0224 à

c:\>chcp 869
Active code page: 869
c:\>rem alt+224 ζ
c:\>rem alt+0224 à
c:\>rem alt 0137 ‰

After adding a Greek keyboard layout in Control panel, and choosing Greek from the language bar, an experiment in WordPad, showed that ALt+0224 then produces ΰ from Code Page 1253 (modern Greek) and Alt+224 produces Σ (though I haven't discovered which DOS/OEM code page that implies)

From which I deduce that

  • Alt+nnn is always the current DOS (also called OEM) code page
  • Alt+0nnn is always the current Windows code page
  • the above differ
  • the language bar can be used to change these.

At least for the programs I tried.

Related Question