Java String does not recognize Japanese Characters
Vadivel Murugesan
Greenhorn
Joined: Jul 19, 2008
Posts: 11
posted
0
Hi Ranchers,
I am trying to print string with Japenese Characters.
But i get Junk Characters as Output
I have changed regional Settings to Japanese also.
Still i am getting problem.
Help me to get this.
Thanks in Advance
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35220
7
posted
0
Where are you printing these to - a console or terminal of some kind? Most of those don't support non-ISO-8859 (or even non-ASCII) characters.
The java program itself contains the Japanese characters. We're trying to print the output on Dos command prompt (windows xp) by running the java program.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35220
7
posted
0
Yes, that won't work.
Vadivel Murugesan
Greenhorn
Joined: Jul 19, 2008
Posts: 11
posted
0
If you dont mind can you give us the technical explanation why it won't work. We wanted to know the other possibilities if any.
It does not work because the Windows XP console window does not normally support those characters - it doesn't have anything to do with the Java program itself. You would probably need a Japanese version of Windows to make the command prompt show these characters. Or use something else than the command prompt window to show the output of your program.
It's just not something that most consoles and terminals were built for. There may be more advanced consoles that can display all Unicode characters -provided all required fonts are present-, but I'm fairly certain that the DOS console can't.
Furthermore, System.out.println will convert anything using the platform default encoding, which on Windows generally is CP-1252 or something like that - which doesn't support CJK characters.