This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Console codepage setting via chcp?


On Sep 24 17:43, Corinna Vinschen wrote:
> Unfortunately there's another problem when utilizing the Console
> codepage.  While testing I found that I was unable to switch the console
> codepage to 932, even though the codepage 932 is installed, and
> MultiByteToWideChar and WideCharToMultiByte both work fine using that
> charset.  Same for 936, 949, and 950.  SetConsoleOutputCP() fails with
> ERROR_INVALID_PARAMETER.
> 
> I asked on the microsoft newsgroup m.p.w.p.kernel and the replies
> suggested that it's possible to use the codepages in the console only
> when switching the system default locale to an appropriate language.

That looks a bit misleading.  Cygwin can of course still print the
characters from the 932 codepage since it's doing the 932->UTF-16
conversion by itself.  It's just not possible to store the value 932 in
the current console settings using the SetConsoleOutputCP function if
the system locale is not one of the matching locales.  I hope I
explained that clear enough.

> So I switched the default system locale to Japanese, rebooted, and when
> starting my shell in a console window, my default codepage was set to
> 932.  Now I could use 932, but 936, 949, and 950 were still invalid.  So
> I switched to Chinese, rebootedd and, voila, I was able to use codepage
> 950.  Then I switched back to English, rebooted and, voila, 932 and 950
> were both invalid again.
> 
> Given that in the Japanese and Chinese locale all other singlebyte
> codepages are still available, I have a hard time to understand the
> scheme behind this.
> 
> Do you think this is a problem?  It's certainly an annoyance when
> testing locale-specific changes, but is it relevant to users?
> 
> Last but not least, the alternative would be to store the Console
> character set as an environment variable, just as the
> "CYGWIN=codepage:[ansi:oem]" setting back in 1.5 times.  Sigh.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]