Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Windows identify non-Unicode applications?

I am building an MFC C++ application with "Use Unicode Character Set" selected in Visual Studio. I have UNICODE defined, my CStrings are 16-bit, I handle filenames with Japanese characters in them, etc. But, when I put Unicode strings containing Japanese characters in a CComboBox (using AddString), they show up as ?????.

I'm running Windows XP Professional x64 (in English). If I use Windows Control Panel Regional and Language Options, Advanced Tab, and set the Language for non-Unicode programs to Japanese, my combo box looks right.

So, I want my combo box to look right, and I want to understand why the "Language for non-Unicode programs" setting is changing the behavior of my Unicode program. Is there something else I should do to tell Windows my application is a Unicode application?

Thanks for any help!

like image 556
Mark Gilbert Avatar asked Oct 29 '09 03:10

Mark Gilbert


1 Answers

Windows knows the difference between Unicode and non-Unicode programs by the functions they call. Most Windows API functions will come in two variants, one ending in A for non-Unicode and one ending in W for Unicode. The include files that define these functions will use the compiler settings to pick one or the other for you automatically.

The characters might not be coming out properly because you've selected a font that doesn't include them to be your default UI font.

like image 181
Mark Ransom Avatar answered Sep 18 '22 14:09

Mark Ransom