UTF-8 support

Bruno Haible bruno at clisp.org
Mon Jul 18 13:43:54 CEST 2005

Alain Bench wrote:
> > GetOEMCP() or GetConsoleOutputCP() (I don't know the difference)
>     I seem to understand GetOEMCP() gives fixed system default OEM CP,
> while GetConsoleOutputCP() gives current console OEM CP. After a user or
> app has done a "chcp 28591" on a French Windows, GetOEMCP()=850 while
> GetConsoleOutputCP()=28591.

Thanks for explaining.

> > The application needs to know where it intends to send a certain
> > string of text.
>     And this app needs to know which Windows specific Get*CP() to call,
> then how to canonicalize charset name. So a Win32 console app can't use
> libcharset, but must more or less duplicate it? There is no text/graph
> mode hint an app could give to libcharset, to directly obtain the wanted
> charset?

Yes. I don't want to introduce new API variants for just a single platform
(because when you do that, the outcome is such baroque like the Microsoft
.NET API). You have the source code of the locale_charset() function, and
it doesn't change very often. It's easy for you to duplicate it, replacing
GetACP() with GetConsoleOutputCP().

> >> [GnuPG] on Win32 uses directly GetConsoleOutputCP(), unless it fails
> >> then GetACP()
>     I should add that the frontend calling GnuPG, and wanting us to
> output ANSI text, has the duty to make GetConsoleOutputCP() fail for us
> returning 0. The Bat!™ makes that, I don't know how.

Interesting hack...


More information about the Gnupg-users mailing list