Next: , Previous: , Up: The User’s View [Contents][Index]


2.4 Obtaining good output in a Windows console

On Windows, consoles such as the one started by the cmd.exe program do input and output in an encoding, called “OEM code page”, that is different from the encoding that text-mode programs usually use, called “ANSI code page”. (Note: This problem does not exist for Cygwin consoles; these consoles do input and output in the UTF-8 encoding.) As a workaround, you may request that the programs produce output in this “OEM” encoding. To do so, set the environment variable OUTPUT_CHARSET to the “OEM” encoding, through a command such as

set OUTPUT_CHARSET=CP850

Note: This has an effect only on strings looked up in message catalogs; other categories of text are usually not affected by this setting. Note also that this environment variable also affects output sent to a file or to a pipe; output to a file is most often expected to be in the “ANSI” or in the UTF-8 encoding.

Here are examples of the “ANSI” and “OEM” code pages:

Territories ANSI encoding OEM encoding
Western Europe CP1252 CP850
Slavic countries (Latin 2) CP1250 CP852
Baltic countries CP1257 CP775
Russia CP1251 CP866

AltStyle によって変換されたページ (->オリジナル) /