- Code pages on Microsoft Windows
-
Contents
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.[1]
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.[1] 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.[2]
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.[3] 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.[4][5][6][7]
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.[7]
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.[6][7]
See also
External links
- Latin1
- Writing International Applications for Windows
- Windows Code Pages
- OEM Code Pages
- ISO Code Pages
- Microsoft DOS chcp command
- MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP
- Keep your eye on the code page
- Code pages are really not enough
- Why ACP != OEMCP (usually)
- Necessary criteria for fonts to be available in a command window
- How to change console font programmatically
- Globalization Step-by-Step
- Change Code Page Command
References
Categories:
Wikimedia Foundation. 2010.