Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / February 2005

Tip: Looking for answers? Try searching our database.

Corrupted Japanese character in VC7.1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TomTom - 16 Jan 2005 21:48 GMT
Hi,

I am very new to international programming and have a basic question. I
created a Japanese  Hello program using VC7.1. All it does it to output
Hello in Japanese. The code below, however, outputs garbage characters. I
saved the C++ file as Unicode, but it appears that it does not make any
difference.

char myArray [20] = "?????"; // Japanese text means 'hello'

cout << endl << myArray;

If you know how this should be coded, can you let me know?

TomTom
Michael (michka) Kaplan [MS] - 17 Jan 2005 17:15 GMT
See

http://blogs.msdn.com/michkap/archive/2005/01/05/347394.aspx

Although you are not hitting the error (the bytes probably do not hit one of
the illegal values the post refers to).

The solution is to save the file as a Unicode.

Signature

MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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

> Hi,
>
[quoted text clipped - 11 lines]
>
> TomTom
TomTom - 18 Jan 2005 09:44 GMT
Thanks. I save with all the UNICODE types available in VS, but still the
text is garbage...

> See
>
[quoted text clipped - 21 lines]
>>
>> TomTom
Michael (michka) Kaplan [MS] - 18 Jan 2005 16:26 GMT
That part likely has more to do with the output code page of the console
itself -- if you try outputing the code points rather than the characters
then you will know if that is what is going on....

Signature

MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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

> Thanks. I save with all the UNICODE types available in VS, but still the
> text is garbage...
[quoted text clipped - 24 lines]
> >>
> >> TomTom
TomTom - 23 Jan 2005 20:05 GMT
Thanks for your suggestion. I am using Windows XP. Although the machine's
system locale is English (U.S), I thought that should have worked. I will
investigate.

> That part likely has more to do with the output code page of the console
> itself -- if you try outputing the code points rather than the characters
[quoted text clipped - 34 lines]
>> >>
>> >> TomTom
"Achim Ruopp [MSFT]" - 10 Feb 2005 21:55 GMT
TomTom,
as you are running on a machine with English US system locale you will face
a number of obstacles:
1.) The VC 7.1 compiler by default only uses the system default codepage,
you can change this with #pragma setlocale; VC 7.1 does not support Unicode
source files (the upcoming version will)
2.) You are outputting the string to a command window that uses the OEM
codepage 437 as an output codepage; this codepage doesn't contain Japanese
characters; there are ways to output Unicode via WriteConsole(), but this
isn't supported in the C runtime until the latest version
3.) On present versions of Windows the command window font selection
depends on the system locale and for English US system locale this
selection doesn't contain a font that could display Japanese characters
..?

In short: displaying Japanese in a command window on an English US system
locale machine is pretty much impossible (note that you can make it work
for other languages like Russian or Greek). You better display English or
switch to Japanese system locale.

Achim Ruopp

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note:  For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.  

TomTom - 11 Feb 2005 04:28 GMT
Thank you Achim. Then, I won't spend time on Console Window any more.

It's good to know that the next version will support Unicode source files.

> TomTom,
> as you are running on a machine with English US system locale you will
[quoted text clipped - 19 lines]
>
> Achim Ruopp

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.