June 16th, 2008

How do the common controls convert between ANSI and Unicode?

Commenter Chris Becke asks how the common controls convert ANSI parameters to Unicode, since the common controls are Unicode internally. Everything goes through CP_ACP, pretty much by definition. The ANSI code page is CP_ACP. That’s what ACP stands for, after all. Now, there are some function families that do not use ANSI. The console subsystem, for example, prefers the OEM character set for its 8-bit strings, and file system functions can go either way, based on the setting controlled by the SetFileAPIsToANSI and SetFileAPIsToOEM functions.

In the scenario Chris describes, I suspect that the problem is not the ANSI-to-Unicode conversion but rather that the font selected into the listview didn’t support the necessary characters.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.