From: Vidya Maheshwar Nabar (firstname.lastname@example.org)
Date: Fri Oct 28 2005 - 03:11:52 CST
Thanks for the response.
I don't want to use TCHAR around the code for some reason. I thought I
should be using 'wchar_t' for holding Japanese text, but 'char ' seemed to
work fine. As for wchar_t, I could see Japanese strings only after I made a
setlocale( LC_ALL, "" ) call, (though I still cannot 'type in' Japanese;
when the focus is in the console, the Japanese IME which is otherwise
displayed, disappears), hence the question about wide char/method usability.
- Why do we need setlocale when using wchar_t to display Japanese strings?
Even with this workaround, I'm still unable to enter Japanese strings via
- This distinction doesn't seem to extend to file streams. So, does console
i/o differ from disk i/o? I tried reading from/writing to files with
Japanese strings using both char and wchar_t (sans setlocale) without any
From: Shawn Steele [mailto:Shawn.Steele@microsoft.com]
Sent: Tuesday, October 25, 2005 11:37 PM
To: Vidya Maheshwar Nabar; email@example.com
Subject: RE: wide chars and methods
Windows 2000 Server is natively Unicode. You cannot "hold all the
characters" of that OS in an 8 bit char.
The windows console is restricted to "ansi" code pages, which is probably
why you're seeing the behavior you're seeing. Its strongly recommended that
you avoid using ANSI applications and use Unicode instead.
From: firstname.lastname@example.org [mailto:email@example.com] On
Behalf Of Vidya Maheshwar Nabar
Sent: Tuesday, October 25, 2005 2:55 AM
Subject: wide chars and methods
I wanted to know why 'wchar_t' data type is required if a 'char' can very
well hold all the characters on a given OS. To elaborate, I run the program
below on a Japanese Win 2K Server and pass Japanese strings:
Code Snippet(VC++ 6.0):
cin >> str;
cout << str << endl;
Note: here, input is U+307E,U+305B and U+3093.
The above program runs fine with chars and cin/cout/scanf/printf, in fact
things go weird when I use wchars and wcin/wcout/wscanf/wprintf, it just
doesn't output anything!
How/Why is cin/cout/scanf/printf able to process Japanese strings on a
Japanese machine with a char, and not wcin/wcout/wscanf/wprintf with wchar?
Isn't that wchars/wide methods are needed for chars beyond the 8-bit range
as char can't handle it? Am I missing something here?
Thanks in advance.
This archive was generated by hypermail 2.1.5 : Fri Oct 28 2005 - 08:38:43 CST