Console codepage setting via chcp?

Andy Koppe
Wed Sep 23 19:17:00 GMT 2009

2009/9/23 Corinna Vinschen:
> Right now, if you switch the charset via the setlocale function, you
> also switch the charset used for console output.

That's quite a unique advantage of the Cygwin console actually,
because it means you always get correct output even if you switch
charset on the fly.

A normal terminal, on the other hand, doesn't actually know what
charset the app running inside it is using. Hence, for correct output,
the user has to make sure the terminal and application charsets match,
or use something like 'luit' to translate between them.

> This is done on the
> grounds that the console isn't capable to switch the console set by
> itself, as it is for terminal emulators like mintty. The problem with
> this approach is even documented in setup2.sgml, just commented out.
> If you use a tool like ssh to connect to a remote machine, then ssh
> uses potentially another locale and charset than the remote shell.

> ssh is always running in the "C" locale

Are you sure? Shouldn't it be calling 'setlocale(LC_ALL, "")', thereby
configuring the console output according to the locale variables?


More information about the Cygwin-developers mailing list