CHCP.com – Windows CMD Command


Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Change the active console Code Page. The default code page is determined by the Windows Locale.

This command is rarely required as most GUI programs and PowerShell now support Unicode. When working with characters outside the ASCII range of 0-127, the choice of code page will determine the set of characters displayed.

Programs that you start after you assign a new code page will use the new code page, however, programs (except Cmd.exe) that you started before assigning the new code page will use the original code page.

Code pageCountry/ Region/ Language
437United States
850Multilingual (Latin I)
852Slavic (Latin II)
855Cyrillic (Russian)
857Turkish
860Portuguese
861Icelandic
863Canadian-French
865Nordic
866Russian
869Modern Greek
1252West European Latin
65000UTF-7 *
65001UTF-8 *

* The 65000/1 code pages are encoded as UTF-7/8 to allow to work with Unicode data in 7-bit and 8-bit environments, however

Even if you use CHCP to run the Windows Console in a Unicode code page, many applications will assume that the default still applies, e.g. Java requires the-Dfile option: java -Dfile.encoding=UTF-8

Unicode characters will only display if the current console font contains the characters. So use a TrueType font like Lucida Console instead of the CMD default Raster Font.

The CMD Shell (which runs inside the Windows Console)

CMD.exe only supports two character encodings Ascii and Unicode (CMD /A and CMD /U)

If you need full Unicode support use PowerShell. There is still VERY limited support for Unicode in the CMD shell, piping, redirection, and most commands are still ANSI only. The only commands that work are DIR, FOR /F, and TYPE, this allows reading and writing (UTF-16LE / BOM) files and filenames but not much else.

Defaults

The default code page in the USA is 437, the default in most of Europe is 850. The number of supported code pages was greatly increased in Windows 7. For a full list of code pages supported on your machine, run NLSINFO (Resource Kit Tools)

Files saved in Windows Notepad will be in ANSI format by default, but can also be saved as Unicode UTF-16LE or UTF -8 and for Unicode files, will include a BOM.
A BOM will make a batch file not executable on Windows, so batch files must be saved as ANSI, not Unicode.

You may also like...

2 Responses

  1. Wiadomości Polska says:

    Couldnt be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!

  2. xmc.pl says:

    actually liked the article you posted actually. it really isnt that simple to find even remotely good posts to read (you know READ! and not just going through it like some zombie before moving on), so cheers mate for really not wasting my time on the god forsaken internet. 😀

Leave a Reply

Your email address will not be published. Required fields are marked *