- Code pages on the Windows OS
=History=
A
code page is a mapping between values stored in memory and the symbols they represent. On MS-DOS systems (prior to Windows) the code page was what today is called the OEM code page. At the time, the common code page (Code page 437 ) contained many box-drawing characters which were used to simulate a GUI in MS-DOS. It did not contain sufficient accented letters to support many European languages. [http://blogs.msdn.com/oldnewthing/archive/2005/03/08/389527.aspx Keep your eye on the code page] ]With the advent of Windows, it was decided that a new code page with those box-drawing characters replaced by accented letters was required (
Windows-1252 ). However, since most existing applications were MS-DOS and might depend on cp437, the existing code page could not be replaced. Hence, the concept of ANSI code pages and OEM code pages was created. ANSI code pages are used by Windows and its applications. Despite its name, ANSI code pages are not endorsed by the American National Standards Institute. OEM code pages are used by MS-DOS. [http://support.microsoft.com/kb/q65124 Writing International Applications for Windows] ]Use
The default OEM code page can be changed by changing the system wide locale and rebooting. This also changes the raster font available to the console. [http://www.microsoft.com/globaldev/getwr/steps/WRG_lclmdl.mspx Globalization Step-by-Step] ] The active OEM code page can be changed by the MS-DOS chcp command, but this will not display correctly unless you switch from the default raster font to Lucida Console. Raster fonts do not support non-system-wide changing of the code page. [ [http://support.microsoft.com/kb/q191309 Change Code Page Command] ] [http://www.computerhope.com/chcphlp.htm Microsoft DOS chcp command] ] [http://www.kpym.com/blog/2005/11/console-howto-change-console-font.html How to change console font programmatically] ] [http://www.aggressivesoftware.com/misc/latin1/ Latin1] ]
Windows
alt codes can be used to input characters from the OEM or ANSI code pages. This is useful for the characters that not available on your keyboard. However, when using MS-DOS, if a character requested from the ANSI code page does not exist in the OEM code page, then a best-fit translation automatically occurs. When using a raster font, the result of the best-fit translation is displayed. When using Lucida Console, the character prior to the best-fit translation is displayed, but the translated byte is actually received by the application. Hence, using the ANSI alt codes in MS-DOS is error prone when the OEM code page does not support all characters in the ANSI code page.Prior to Windows Vista, the active console code page can be changed programatically, but the console font cannot. So if the console is in the default configuration (using raster fonts), then programatic changing of the code page is not useful for console applications because incorrect characters will be displayed to the user.
See also
*
Code page 437
*Code page 850
*Windows-1252
*Alt code External links
* [http://www.aggressivesoftware.com/misc/latin1/ Latin1]
* [http://support.microsoft.com/kb/q65124 Writing International Applications for Windows]
* [http://www.microsoft.com/globaldev/reference/wincp.mspx Windows Code Pages]
* [http://www.microsoft.com/globaldev/reference/oem.mspx OEM Code Pages]
* [http://www.microsoft.com/globaldev/reference/iso.mspx ISO Code Pages]
* [http://www.computerhope.com/chcphlp.htm Microsoft DOS chcp command]
* [http://support.microsoft.com/kb/108450 MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP]
* [http://blogs.msdn.com/oldnewthing/archive/2005/03/08/389527.aspx Keep your eye on the code page]
* [http://blogs.msdn.com/michkap/archive/2005/03/01/382289.aspx Code pages are really not enough]
* [http://blogs.msdn.com/michkap/archive/2005/02/08/369197.aspx Why ACP != OEMCP (usually)]
* [http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q247815 Necessary criteria for fonts to be available in a command window]
* [http://www.kpym.com/blog/2005/11/console-howto-change-console-font.html How to change console font programmatically]
* [http://www.microsoft.com/globaldev/getwr/steps/WRG_lclmdl.mspx Globalization Step-by-Step]
* [http://support.microsoft.com/kb/q191309 Change Code Page Command]References
Wikimedia Foundation. 2010.