RE: codepages on Windows

From: F. Avery Bishop (
Date: Mon Sep 25 2000 - 17:33:21 EDT

The "multilingual" sample in the platform SDK and the sample code with this

show how to handle WM_CHAR messages in apps that want to be Unicode

F. Avery Bishop
Program Manager, Speech API

-----Original Message-----
From: Michael (michka) Kaplan []
Sent: Friday, August 11, 2000 6:54 AM
To: Unicode List
Subject: Re: codepages on Windows

Actually, the Platform SDK docs are really inadequate here. Although the
wparam is listed as "Specifies the character set of the new locale" it is
impossible to get past the fact that WM_INPUTLANGCHANGEREQUEST talks about
INPUTLANGCHANGE_SYSCHARSET as meaning "The new input locale's keyboard
layout can be used with the system character set.".

It is very possible that it could mean code page here.

In any case, since GetLocaleInfo provides the way to get from an LCID/langid
to a code page and TranslateCharsetInfo provides a way to get from a code
page to a charset, I think these APIs will give you the answer no matter
what you are trying to do.

I actually do a lot of work with Visual Basic, which always approves
keyboard lang changes yet dos not handle them properly (so you get garbage
when you type), so I actually do my own keyboard handling to get the right
Unicode characters out of the keyboard in this case. Frustrating to develop,
but very satisfying to see working properly! :-) In any case, I do not pay
any attention at all to the WM_INPUTLANGCHANGE* messages since at the
control level I do not get them anyway, and the solution works well for
Unicode controls in non-Unicode applications.

Maybe a new book idea, title something like "Under Windows, ANSI is a four
letter word?" <g>


Michael Kaplan
Trigeminal Software, Inc.

----- Original Message -----
From: <>
To: "Unicode List" <>
Sent: Friday, August 11, 2000 6:25 AM
Subject: Re: codepages on Windows

> >wParam of WM_INPUTLANGCHANGE *is* the codepage ID (that you can pass
> >to MultiByteToWideChar(), for example).
> I believe wParam gives a charset id, not a codepage id. There's a
> difference. I wasn't sure how one gets codepage from charset (short of
> maintaining a table).
> Unfortunately, the MSDN library page on WM_INPUTLANGCHANGE doesn't
> reference under "See also" either TranslateCharsetInfo or GetLocaleInfo.
> Neither does it say anything under "Remarks". It seems to me that
> they should provide more help in knowning how an ANSI-registered app can
> handle Unicode characters, in this case how to take characters received
> from WM_CHAR (or pairs from WM_IME_CHAR) and translate them using
> MultiByteToWide, for which the codepage associated with the current
> InputLocale must be known. Kano's book also doesn't discuss this, neither
> does the recent MSPress book International Programming for MS Windows by
> David Schmitt.
> - Peter
> --------------------------------------------------------------------------
> Peter Constable
> Non-Roman Script Initiative, SIL International
> 7500 W. Camp Wisdom Rd., Dallas, TX 75236, USA
> Tel: +1 972 708 7485
> E-mail: <>

This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:14 EDT