473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Kanji character display in 7.1 MFC application vs. 6.0 MFC

Here is the problem we've encountered. An application that used to
successfully display Japanese Kanji characters no longer does so when
recompiled with 7.1

When compiled with the 6.0 compiler, both of the following methods are
successful in displaying Japanese characters in a multi-line CEdit control on
a machine that is fully configured as a Japanese machine (Japanese version of
Windows 2000 SP4). The same code, compiled with 7.1, only displays blanks or
incorrect characters. The program is compiled for MBCS, not Unicode, so we
are in effect calling SetWindowTextA in Method 1.

METHOD 1:
=========

// Make a little buffer for the MBCS character

TCHAR cPtr[6];
for (int i = 0; i < 6; i++) cPtr[i] = 0;
int iRet = WideCharToMultiByte (932, 0, L"\x3042", 1, cPtr, 6, NULL, NULL);
// Display Hiragana A character
m_cProblemEdit.SetWindowText(cPtr);

METHOD 2:
=========

CString sProblem;
//...Iinitialize sProblem with Kanji string ....
// Display string
m_CProblemEditSetWindow(sProblem);

Nov 17 '05 #1
9 2137
Hi,
Here is the problem we've encountered. An application
that used to successfully display Japanese Kanji characters
no longer does so when recompiled with 7.1


For a VC7.1 project, you need to specify its "Culture" to Japanese, this
will make your programdisplay the Japanese Kanji characters as expected.

You can configure it in the Project property configuration(Project Property
Pages/Resources/General/Culture).
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #2

""Gary Chang[MSFT]"" <v-******@online.microsoft.com> wrote in message
news:BP**************@TK2MSFTNGXA01.phx.gbl...
Hi,
Here is the problem we've encountered. An application
that used to successfully display Japanese Kanji characters
no longer does so when recompiled with 7.1


For a VC7.1 project, you need to specify its "Culture" to Japanese, this
will make your programdisplay the Japanese Kanji characters as expected.


I'm a little baffled by this, but maybe I don't understand it. What if the
application is supposed to work with many "cultures" and not just the
Japanese culture? As long as one doesn't switch their default (for
non-unicode apps) code page, our app will support any double-byte language.
Sounds like if we compiled with VC7.1 it no longer would. Am I missing
something?

-Michael Viking
Nov 17 '05 #3
Hi Michael,
I'm a little baffled by this, but maybe I don't understand it.
What if the application is supposed to work with many
"cultures" and not just the Japanese culture?


For a general .NET WinForm application, you can set the target Form's
"Localizable" property to true, then specify the language you need to
support in its "Language" property, the VS2003 IDE will generate the
multiple language support resource file respectively.

But in your case, to specify the project's "Culture" property is in order
to tell the VS2003 IDE based on which language locale to compile your MFC
project's resource, it is different with the general .NET application.
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #4
Gary, I don't think I actually did understand you. Sorry. Please see
inline:

""Gary Chang[MSFT]"" <v-******@online.microsoft.com> wrote in message
news:zN**************@TK2MSFTNGXA01.phx.gbl...
Hi Michael,
I'm a little baffled by this, but maybe I don't understand it.
What if the application is supposed to work with many
"cultures" and not just the Japanese culture?
For a general .NET WinForm application, you can set the target Form's
"Localizable" property to true, then specify the language you need to
support in its "Language" property, the VS2003 IDE will generate the
multiple language support resource file respectively.


So what would I select if I wanted to support Japanese, Chinese and Korean?

But in your case, to specify the project's "Culture" property is in order
to tell the VS2003 IDE based on which language locale to compile your MFC
project's resource, it is different with the general .NET application.
So I'd need to build my app three times with a different setting each time
to support Korean, Chinese and Japanese?


Thanks for your understanding!

I'm doing my best.

Thanks,
-Michael
Nov 17 '05 #5
Hi Michael,
So what would I select if I wanted to support Japanese,
Chinese and Korean?
In a .NET WinForm application, you may set the target Form's "Localizable"
property to "True", then select the languages you want to support in the
above "Language" property's drop-down listbox one by one, each time you
select a language in that listbox, the VS2003 IDE will generate the
corresponding language support resource file for the project.
So I'd need to build my app three times with a different
setting each time to support Korean, Chinese and Japanese?


It depends on do you need to produce the specific language version
application, if yes, you may need to build your project 3 times with the
different culture setting respectively. If not, I suggest you can use the
general convention in such scenario, create the resource only DLLs for your
application to support the multiple languages, please refer to the
following MSDN KB and sample links for details:

http://support.microsoft.com/default...b;EN-US;198846
How To Create Localized Resource DLLs for MFC Application

Multiple language support for MFC applications with extension DLL
http://www.codeproject.com/cpp/Multi...tMFCExtDLL.asp
Wish this help!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #6
Hi Gary,

Thanks for the reply. We are still not able to get Kanji characters to
display, even when setting the culture to Japanese in the resource settings.
The only way we have found that we can get anything to work is to create an
explicit font using one of the various CreateFont routines and use SetFont on
the control, for example:

CClientDC dc(this);
CFont font;
VERIFY(font.CreatePointFont(120, _T("MS Mincho"), &dc));
m_cEdit.SetFont(&font);
font.DeleteObject();

....though it seems that the act of creating the font is the important thing.
The parameters don't seem to make much difference, even the font typeface or
height. Please note we are not storing these Kanji strings as resources.
They are input by the user via a programmatic interface and then passed
through the application for eventual display in various controls. The
application is otherwise English. So we are not trying necessarily to
retarget the application at any one language. We are simply trying to get
the controls to properly display an MBCS character string, in this case
Japanese. At any rate, we did not have to have this font code in our 6.0
version, but now we seem to need it in order to get this functionality to
work with 7.1. Any additional ideas or comments on this? Thanks!

""Gary Chang[MSFT]"" wrote:
Hi,
Here is the problem we've encountered. An application
that used to successfully display Japanese Kanji characters
no longer does so when recompiled with 7.1


For a VC7.1 project, you need to specify its "Culture" to Japanese, this
will make your programdisplay the Japanese Kanji characters as expected.

You can configure it in the Project property configuration(Project Property
Pages/Resources/General/Culture).
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #7
Hi,

I am glad to know you have already found the resolution to your problem, I
tested with a simple MFC6 dialogbox program, setting the culture of its
upgraded VC7 project worked for me, it appears we don't have a similar test
case:(
Thanks for sharing this useful tips with us!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #8
Gary, thanks! All clear now.
-Michael Viking
Nov 17 '05 #9
You are welcome, Michael:)

Good luck!
Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabian | last post by:
I have a page (ok, will have a page) written in Japanese. As we all know, Japanese is written with some pretty funky characters, and it is conventional to write the so-called furigana above these...
76
by: Zenobia | last post by:
How do I display character 151 (long hyphen) in XHTML (utf-8) ? Is there another character that will substitute? The W3C validation parser, http://validator.w3.org, tells me that this character...
50
by: The Bicycling Guitarist | last post by:
A browser conforming to HTML 4.0 is required to recognize &#number; notations. If I use XHTML 1.0 and charset UTF-8 though, does &eacute; have as much support as é ? Sometimes when I run...
2
by: Mike Turco | last post by:
I have a bunch of text files I'm trying to parse. The files all have several occurrences of chr(26), which is EOF (End Of File). Each file is ~ 1meg of text, and every file is a real mess. The...
18
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
1
by: Kenneth McDonald | last post by:
I am going to demonstrate my complete lack of understanding as to going back and forth between character encodings, so I hope someone out there can shed some light on this. I have always...
2
by: jai04082000 | last post by:
Hi all, Please guide me, I am involved in migration of some of the Excel files of MS EXCEL ( Japanese - Kanji ) into DB2/400. I am new to this env so If I am asking foolish question, forgive...
10
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For...
0
by: uthnak | last post by:
Dear All, I have a program when in I key in a chinese word(Kanji) and give its equivalent word in English and Save. I have a peculiar problem. I enter a Chinese word, or paste a chinese...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.