Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Japanese characters in CEdit and CComboBox

149 views
Skip to first unread message

Michael Reim

unread,
Oct 31, 2007, 6:46:34 AM10/31/07
to
Hello all

We recently upgraded from VC6.0 to VS2005, and now we have problems with the
japanese version of our programs.
In some edit boxes and editable combo boxes it's not possible to show
japanese characters.
Amazingly the drop down part of the combo box displayes the japanese text
ok, but if you select this text it isn't correct in the edit part.
After debugging I narrowed it down to a problem with resource files.
We only have this problems in dialogs where we changed the default font.

We changed the standard line
FONT 8, "MS Shell Dlg", 0, 0, 0x1
to
FONT 10, "MS Sans Serif", 0, 0, 0x1

If we now change this line to
FONT 10, "MS Sans Serif", 0, 0, 0x80
(japanese character set) everything works as it should.

But as we have a huge amount of resource files and as it would mean a lot of
error-prone work, each time we get a new japanese translation, I want to
know if it is possible to set something like a flag for the new MFC (7.1) to
behave like the old one (4.2)?

TIA
--
Michael Reim
Michael DOT Reim AT helmut-fischer DOT de


Tom Serface

unread,
Oct 31, 2007, 12:55:33 PM10/31/07
to
Some OS's (Win 2K for example) don't seem to have all of the JA chars in the
ms sans serif font. You should use something like MS Gothic or the Shell
Dlg font if you want to be safe. One easy way to fix this up is to just
edit the .rc file with notepad and find the places where the font is set. I
find that to be much quicker than using the resource editor.

You will also want to run the actual dialogs on a machine with Japanese
Windows loaded or at least a MUI since the dialogs often display differently
in real life than they do in the resource editor.

Tom

"Michael Reim"
<nospammich...@REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in
message news:%23HbzPt6...@TK2MSFTNGP02.phx.gbl...

Norman Diamond

unread,
Oct 31, 2007, 9:49:47 PM10/31/07
to
I wonder what the reason was for switching from MS Shell Dlg to MS Sans
Serif. Microsoft says that MS Shell Dlg is designed to work on every user's
Windows language version as long as the developer is using English-US
Windows with their compiler. In my experience MS Shell Dlg has worked with
every user's Windows language version (that we've seen so far) when the
developers are using Japanese Windows with our compiler. Visual Studio
defaults to setting the font as MS Gothic, but I recommend changing it to MS
Shell Dlg if there's any chance that the program might be exported.

Font size 8 wasn't a good choice of course. Best would be to get the user's
font size settings, which default to 9 unless the user has changed it. 10
is usually readable though.

Also you need to run the actual dialogs on an a machine that actually uses
the target language version of Windows (Japanese in this case). If there's
any chance that a program will be used by an end user in an MUI version,
then you need to test the actual dialogs in both the actual target language
version and the MUI version. The two versions are not bug-for-bug
compatible. MUI is convenient for some end users, but it's not at all
convenient for developers.


"Tom Serface" <tom.n...@camaswood.com> wrote in message
news:32CBC683-20B2-4373...@microsoft.com...

Michael Reim

unread,
Nov 5, 2007, 5:10:38 AM11/5/07
to
Thank you Tom

After reading more about this topic, this is exactly the way we are going to
do it.
We change all occurences of "MS Sans Serif" to "MS Shell Dlg".

Unfortunatly there is a little caveat, that we have sources that have to be
compatible with WindowsCE 4.2 and 5.0.
So we have to duplicate these. Not nice, but it works.

BTW: selecting "MS Shell Dlg" doesn't seem to be possible in resource
editor.

--
Michael Reim
Michael DOT Reim AT helmut-fischer DOT de


"Tom Serface" <tom.n...@camaswood.com> schrieb im Newsbeitrag
news:32CBC683-20B2-4373...@microsoft.com...

Michael Reim

unread,
Nov 5, 2007, 5:44:34 AM11/5/07
to
Hello Norman

Changing MS Sans Serif to MS Shell Dlg seems to do the trick.

>I wonder what the reason was for switching from MS Shell Dlg to MS Sans
>Serif.

We didn't switch, Microsoft did. In VC6.0 the default was MS Sans Serif, in
Visual Studio 2005 the default is MS Shell Dlg. Furthermore the old MFC
automatically replaced MS Sans Serif with DEFAULT_GUI_FONT, the new MFC does
the same for MS Shell Dlg only. So all resources generated with VC6.0 now
behave differently with the new MFC.


> Microsoft says that MS Shell Dlg is designed to work on every user's
> Windows language version as long as the developer is using English-US
> Windows with their compiler.

I did some tests and MS Shell Dlg seems to work the same way as MS Sans
Serif did with the old MFC.


> Also you need to run the actual dialogs on an a machine that actually uses
> the target language version of Windows (Japanese in this case). If
> there's any chance that a program will be used by an end user in an MUI
> version, then you need to test the actual dialogs in both the actual
> target language version and the MUI version. The two versions are not
> bug-for-bug compatible. MUI is convenient for some end users, but it's
> not at all convenient for developers.

Of course you are right, it's always a good choice to test the program on
the target system.


Thank you for your help.

Tom Serface

unread,
Nov 5, 2007, 11:06:15 AM11/5/07
to
Yeah, I've noticed that too. I think it is a part of another font. I
typically use MS Gothic UI. Glad you got it to to work.

Tom

"Michael Reim"
<nospammich...@REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in

message news:%230SneQ5...@TK2MSFTNGP03.phx.gbl...

Tom Serface

unread,
Nov 5, 2007, 11:06:57 AM11/5/07
to
I just had another thought. It may be that the MS Shell Dlg font is just
getting substituted for something that works as well.

Tom

"Michael Reim"
<nospammich...@REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in

message news:%230SneQ5...@TK2MSFTNGP03.phx.gbl...

Mihai N.

unread,
Nov 5, 2007, 11:12:50 PM11/5/07
to
> BTW: selecting "MS Shell Dlg" doesn't seem to be possible in resource
> editor.
This is true if you are still using VS6.
Works with newer versions.


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

David Ching

unread,
Nov 6, 2007, 9:27:45 AM11/6/07
to
"Mihai N." <nmihai_y...@yahoo.com> wrote in message
news:Xns99DFCDA1...@207.46.248.16...

>> BTW: selecting "MS Shell Dlg" doesn't seem to be possible in resource
>> editor.
> This is true if you are still using VS6.
> Works with newer versions.
>

Doesn't WinXP (and perhaps Vista?) use "MS Shell Dlg 2" to get Tahoma
instead of MS Sans Serif?

-- David


Michael Reim

unread,
Nov 6, 2007, 10:55:33 AM11/6/07
to
>> BTW: selecting "MS Shell Dlg" doesn't seem to be possible in resource
>> editor.
> This is true if you are still using VS6.
> Works with newer versions.
Doesn't work with VS2005 either.

Mihai N.

unread,
Nov 7, 2007, 3:13:50 AM11/7/07
to
> Doesn't WinXP (and perhaps Vista?) use "MS Shell Dlg 2" to get Tahoma
> instead of MS Sans Serif?

"Yes" for XP (but there is nothing in VS to allow that)
And "No" for Vista (MS renounced the "MS Shell Dlg X" idea)

Mihai N.

unread,
Nov 7, 2007, 3:17:57 AM11/7/07
to
>>> BTW: selecting "MS Shell Dlg" doesn't seem to be possible in resource
>>> editor.
...

> Doesn't work with VS2005 either.

In VS 2005 - resource editor - dialog properties you have a font selection
field (with a '...' button that opens the standard font selection dialog).
It is not possible to select "MS Shell Dlg" from there (because that only
shows *real fonts*, and "MS Shell Dlg" is not a real font)

But you also have a boolean field called "Use System Font"
Set that to True and it will reset the font to "MS Shell Dlg"

David Ching

unread,
Nov 7, 2007, 8:10:10 AM11/7/07
to
"Mihai N." <nmihai_y...@yahoo.com> wrote in message
news:Xns99E1259...@207.46.248.16...

>> Doesn't WinXP (and perhaps Vista?) use "MS Shell Dlg 2" to get Tahoma
>> instead of MS Sans Serif?
>
> "Yes" for XP (but there is nothing in VS to allow that)
> And "No" for Vista (MS renounced the "MS Shell Dlg X" idea)
>

Thanks Mihai. It does seem difficult to use MS Shell Dlg 2 for XP and
something else for Vista, although as David W pointed out, this is hard
anyway due to the Segoe UI (default Vista font) being smaller and thus the
entire dialog layout changes.

-- David


Tom Serface

unread,
Nov 7, 2007, 11:38:20 AM11/7/07
to
One thing that we recently noticed is that if you use MS Sans Serif for
Japanese it works OK on XP, but on Win 2K the characters aren't there. If I
install the XP font on Win 2K it works OK. There must have been some
upgrade to the font.

Tom

"Mihai N." <nmihai_y...@yahoo.com> wrote in message

news:Xns99E130C...@207.46.248.16...

Norman Diamond

unread,
Nov 7, 2007, 8:08:05 PM11/7/07
to
"David Ching" <d...@remove-this.dcsoft.com> wrote in message
news:gPiYi.521$sm1...@nlpi068.nbdc.sbc.com...

Actually the problem is the opposite. It's hard anyway due to Meiryo (half
default Vista font) being bigger and thus half of the entire dialog layout
changes.

In lots and lots of built-in dialogs in Vista, there's a combination of
Meiryo (fat antialiased characters) and MS UI Gothic (thinner
non-antialiased characters that users have been accustomed to for the past
10 years). I don't quite have any opinion about whether Meiryo is better
because I like antialiasing but don't like wasting real estate in the
screen. I do have an opinion about lots and lots of built-in dialogs in
Vista; the combination of antialiased and non-antialiased fonts is very
jarring visually and hard to read. Microsoft has assured me that this will
not be fixed.

Mihai N.

unread,
Nov 7, 2007, 11:50:10 PM11/7/07
to
> One thing that we recently noticed is that if you use MS Sans Serif for
> Japanese it works OK on XP, but on Win 2K the characters aren't there. If
I
> install the XP font on Win 2K it works OK. There must have been some
> upgrade to the font.

Kind of weird.

MS Sans Serif is a bitmap font (.FON), I doubt is has Japanese in it.
On my XP that is mapped to SSERIFE.FON
(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts)

Microsoft Sans Serif is not a real font, it linked to Japanese fonts
in XP (see HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\FontLink\SystemLink)

Windows XP (compared to 2000) has a lot of improvements when it comes to
font linking/mapping/fallback/substitution/youNameIt, so that it is almost
difficult to show squares :-)
So I don't see how just copying a bitmap font to 2000 can improve things.

Tom Serface

unread,
Nov 8, 2007, 12:06:09 AM11/8/07
to
Hmmm. Oh well. We ended up using MS Gothic UI instead so the mystery will
remain unresolved :o)

Tom

"Mihai N." <nmihai_y...@yahoo.com> wrote in message

news:Xns99E1D3F6...@207.46.248.16...

Mihai N.

unread,
Nov 8, 2007, 1:49:06 AM11/8/07
to
> Hmmm. Oh well. We ended up using MS Gothic UI instead so the mystery will
> remain unresolved :o)

Ok. But this also does not work ok on 2000 (there is no MS Gothic UI, only MS
Gothic).

And another trouble with 2000: MS Gothic has an English name and a
Japanese name. And the font is recognized by one name only, matching the
system locale. If the system locale is Japanese, you see the Japanese name,
otherwise you see the English one. So no matter what name you use in the
resources (Jp or En), it is guaranteed to fail in some cases.

In improvement in Win XP is that the fonts are recognized no matter
if you use the localized name or the English name.

Norman Diamond

unread,
Nov 8, 2007, 2:20:15 AM11/8/07
to
"Mihai N." <nmihai_y...@yahoo.com> wrote in message
news:Xns99E1E81F...@207.46.248.16...

>> Hmmm. Oh well. We ended up using MS Gothic UI instead so the mystery
>> will remain unresolved :o)
>
> Ok. But this also does not work ok on 2000 (there is no MS Gothic UI, only
> MS Gothic).

MS Gothic and MS P Gothic existed in Windows NT4 RTM and probably earlier.
MS Gothic and MS P Gothic and MS UI Gothic came in with Windows NT4 SP4,
breaking MS Word 97 and MS Word 98.

Windows 2000 preserved the collection of three fonts and preserved the
breakage of Word 97 and 98 (except that the US version of Windows 2000
received a fix during beta testing so that Japanese Word 97 and 98 work on
US Windows 2000 while breaking on Japanese Windows 2000).

SX

unread,
Jan 17, 2008, 3:41:02 PM1/17/08
to
Hi,
I see similar problem, we have built application with VS 6.0, application
is running on WIN2003, and our RC file uses "MS UI Gothic" size 9, some of
our CEdit controls do not display SHIFT_JIS characters in any way, via paste
from Clipboard, or, via .LoadString programmatically. All other controls
(like CComboBox) display SHIFT_JIS characters just fine. Any idea how this
can happen?


Thanks!, SX

Michael Reim

unread,
Jan 18, 2008, 1:31:08 AM1/18/08
to
Are you sure, that "MS UI Gothic" supports SHIFT_JIS?
Try using "MS Shell Dlg". This is a pseudo font, which is exchanged at
runtime by the font which supports the correct code page.

Since we use "MS Shell Dlg" we have no problems anymore.

HTH


--
Michael Reim
Michael DOT Reim AT helmut-fischer DOT de


"SX" <S...@discussions.microsoft.com> schrieb im Newsbeitrag
news:DD8FCA09-2A01-46E2...@microsoft.com...

SX

unread,
Jan 18, 2008, 11:45:02 AM1/18/08
to
Hi Michael,
thanks for suggestion but it did not help. In another attempt I rebuilt the
Japanese resource dll with VS .NET 2003, result is the same, some CEdit
controls do not display Japanese chars correctly.

Regards, Stevan

0 new messages