cygwin + GetConsoleOutputCP

Thomas Wolff towo@towo.net
Sun Mar 20 23:31:00 GMT 2011


Am 20.03.2011 20:13, schrieb Charles Wilson:
> ...
>
> Note that this autodetect, if it works, assumes that the console's CP is
> the input file's CP.  Fair enough -- and it's an overridable default
> anyway.  However, I wonder if, in cygwin-1.7, we actually can/should use
> the "console codepage" in ANY way.  Here's the code:
>
> querycp.c:
> #elif defined (WIN32) || defined(__CYGWIN__)
>
> /* Erwin Waterlander */
>
> #include<windows.h>
> unsigned short query_con_codepage(void) {
>     return((unsigned short)GetConsoleOutputCP());
> }
> #else
>
> Or if instead, on cygwin, we should use some other mechanism (locale
> settings?) to determine the correct default "input" codepage.
>
> Comments?
On cygwin, GetConsoleOutputCP is largely irrelevant and is actually 
*not* the console's "codepage" for cygwin programs.
Therefore, defined (WIN32) and defined (__CYGWIN__) should be split and 
either setlocale or nl_langinfo should be used.

Thomas

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list