472,378 Members | 1,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 2075
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.