ss64.com Open in urlscan Pro
216.92.186.205  Public Scan

URL: https://ss64.com/nt/chcp.html
Submission: On January 16 via manual from AU — Scanned from AU

Form analysis 1 forms found in the DOM

GET https://www.google.com/search

<form action="https://www.google.com/search" method="get">
  <input type="text" name="q" id="qu" size="27" maxlength="255" aria-label="Search text">
  <input class="submit mousetrap" value="Search" id="btn" type="submit">
  <input type="hidden" name="sitesearch" value="ss64.com/nt/">
</form>

Text Content

 * SS64
 * CMD
 * How-to
 * 


CHCP.COM

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

Syntax
      CHCP code_page

Key
   code_page  A code page number (e.g. 437)  

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, such as
some box characters, 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 page Country/ Region/ Language   437 United States default code page in the
US 850 Multilingual (Latin I) default code page in most of Europe 852 Slavic
(Latin II)   855 Cyrillic (Russian)   857 Turkish   860 Portuguese   861
Icelandic   863 Canadian-French   865 Nordic   866 Russian   869 Modern Greek  
1252 West European Latin   65000 UTF-7 *   65001 UTF-8 *  

* The 65000/1 code pages are encoded as UTF-7/8 to allow to working 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.


CODE PAGES

> 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.


EXAMPLES

View the current code page:
chcp

Change the code page to Unicode/65001:
chcp 65001

“Remember that there is no code faster than no code” ~ Taligent's Guide to
Designing Programs


RELATED COMMANDS

[Undocumented] CHCP - Forum.
Transcoding to ANSI with CHCP - Forum.
Full list of Code Page Identifiers - docs.microsoft.com
Windows Locale codes.
TYPE - can print UTF-16LE files with a BOM regardless of the current codepage.
What every software developer must know about Unicode and Character Sets ~ Joel
Spolsky.
Equivalent PowerShell: [Console]::OutputEncoding, All text input is
automatically converted to Unicode.
Equivalent bash command (Linux): LANG - locale category environment variable &
LC_* variables for locale category.

Powered by pixfutureⓘ


--------------------------------------------------------------------------------

 
Copyright © 1999-2023 SS64.com
Some rights reserved