- Need HELP displaying MBCS characters or SBCS characters in different code page
- Posted by John on September 14th, 2003
Hi,
I hope someone can help me out. I'm currently trying to convert one
of my app into a different language version and I'm having trouble
trying to display the MBCS characters correctly.
1. First I put all my text into string resource.
2. For language that uses MBCS (like Chinese), I manually edit the
resource file using notepad to display the chinese characters and then
save the file in UNICODE format.
3. Then I load the text using LoadString function.
4. When I try to display the text using DrawText, the characters come
out as "?".
Can anyone tell me what I need to do? I got the same problem with
drawing SBCS characters that is in different code page (ie not 1252).
I tried experiementing with using setlocale function to set the code
page and I've also tried setting the font to "MingLiU" to display the
chinese characters, but it still come out as question mark. Can
anyone help?
John
- Posted by Michael \(michka\) Kaplan [MS] on September 14th, 2003
You need to use UNICODE -- if you load the resources and display them with
non-Unicode functions, they will be converted in the way you see now.
--
MichKa [MS]
This posting is provided "AS IS" with
no warranties, and confers no rights.
"John" <a@b.com> wrote in message
news:j819mv4s5vh500cv0216bqir3d0kspmjrv@4ax.com...
- Posted by John on September 14th, 2003
Thanks. You're right. Once I changed my LoadString function to
LoadStringW and my DrawText function to DrawTextW, I managed to be
able to display the character. But I still need to specify a proper
font. Now I have the following questions:
1. Is "MingLi" a standard BIG5 chinese font that everyone who has a
chinese OS should have? What about other languages such as Arabic?
Is there a list of standard fonts for these other languages that we
should use?
2. Does Win ME support unicode? If I start using unicode, I need to
make sure that it still works under Win ME.
3. Is it possible to convert the unicode resource back to MBCS and
then display it using non-Unicode functions? I tried using
WideCharToMultiByte function but it doesn't seem to work. Maybe I
used the wrong parameters?
John
On Sun, 14 Sep 2003 09:39:03 -0700, "Michael \(michka\) Kaplan [MS]"
<michkap@online.microsoft.com> wrote:
- Posted by Michael \(michka\) Kaplan [MS] on September 14th, 2003
"John" <a@b.com> wrote...
I assume you mean MingLiU (aka ²Ó©úÅé) ?
To be honest, you could use Tahoma for all non-CJK languages. But this may
not provide the best user experience (I have a colleague from Iran who
thinks that Tahoma for Farsi looks "cartoonish"). It is best to have
intelligent decisions made on the best font to use for any market to which
you plan to ship.
No, WinMe does not support Unicode, but it does have both Traditional
Chinese and Arabic versions. if you are truly attempting to create
multilingual applications then the only realistic solution is to not use the
Win9x (which includes WinMe) platform.
No, it is IMPOSSIBLE to convert it back to the default system code page and
expect it to work, unless you are on a system that has the right" default
system code page. Basically, any time you would have gotten away with
LoadStringA and DrawTextA.
Otherwise, you had better hope that your users speak fluent question mark!
:-)
--
MichKa [MS]
This posting is provided "AS IS" with
no warranties, and confers no rights.
- Posted by John on September 18th, 2003
Hi Michael,
Thanks for the advice. I've decided to just stick with UNICODE. I've
been updating all my code to use UNICODE the last couple of days.
Everything seems to work well except a couple of problems.
1. When I tried to display the Window's title bar with some unicode
text, it comes out as "?". I've tried changing the Windows's font by
doing a SendMessage with a WM_SETFONT during the Window's WM_CREATE
response. But it doesn't seem to work. The windows title still
display the unicode text as "?". Am I missing something?
2. Some of the controls in the dialog boxes created in the resources
files seem to have the same problem. Even if I tried to change the
font during the WM_INITDIALOG response, my COMBO box's text is still
displaying "?" for the unicode text. Do I need to create the COMBO
box dynamically in order to get this to work?
John
On Sun, 14 Sep 2003 15:13:54 -0700, "Michael \(michka\) Kaplan [MS]"
<michkap@online.microsoft.com> wrote:
- Posted by Michael \(michka\) Kaplan [MS] on September 19th, 2003
"John" <a@b.com> wrote...
This would suggest that the Window is not Unicode.
This would suggest that the dialog is not Unicode.
As a rule, question marks do not indicate a font problem. They indicate a
conversion from Unicode at some point to a code page that does not contain
the character(s) in question.
--
MichKa [MS]
This posting is provided "AS IS" with
no warranties, and confers no rights.
- Posted by John on September 19th, 2003
I see. I'll get the windows part fixed. But I'm not sure how to
specify my dialog boxes to be Unicode. I'm using Visual Studio 6.
The resource editor actually won't even popup when I changed my RC
file into Unicode. Are there any tricks for me to do to make them
Unicode?
On Fri, 19 Sep 2003 05:04:11 -0700, "Michael \(michka\) Kaplan [MS]"
<michkap@online.microsoft.com> wrote:
- Posted by John on September 20th, 2003
Nevermind. I just realized I created my dialogs using DialogBoxParam
instead of DialogBoxParamW.
On Fri, 19 Sep 2003 16:17:27 -0700, John <a@b.com> wrote: