Chinese chars!

Started by
2 comments, last by bulletthebluesky 15 years, 5 months ago
How can this become Chinese chars? I want European standard! pretty funny though... g_font->DrawText(NULL,(LPCWSTR)buffer,-,&font_rect,UNICODE,0xFFFFFFFF); //Color
Advertisement
Quote:Original post by Meshboy
How can this become Chinese chars? I want European standard!
pretty funny though...

g_font->DrawText(NULL,(LPCWSTR)buffer,-,&font_rect,UNICODE,0xFFFFFFFF); //Color


At a wild ugess, I'd say it could be because your buffer contains chinese chars.
(Either that, or it contains other data, which can not be meaningfully cast to LPCWSTR)

To get useful answers, you might just have to provide a bit of information about your problem. Such as what you're calling DrawText with. (It also wouldn't hurt to specify what DrawText or g_font are. We can guess, of course, but you generally get better answers when you provide enough information to make an answer *possible*
Without further info we can only guess:

buffer is an ascii string (char array), it didn't compile, so you simply pasted (LPCWSTR) in front of it.

Your project seems to use Unicode, tries to process the string as unicode and fails.

If your string is a literal (constant), you can put a L in front of it:

g_font->DrawText( NULL, L"Hello World, ... )


If not, you have to convert your ascii string to unicode with MultiByteToWideChar.


Or you can explicitely use the ascii version of DrawText (DrawTextA).

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Let me guess, you are using Visual C++? If so, go to project settings,configuration properties, and under project defaults you should see character set. Change it from Unicode to multi byte.

If you aren't using Visual C++, I cannot help you.

This topic is closed to new replies.

Advertisement