jQuery in Action, 2nd edition
The moose likes Beginning Java and the fly likes Java String does not recognize Japanese Characters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Java String does not recognize Japanese Characters" Watch "Java String does not recognize Japanese Characters" New topic
Author

Java String does not recognize Japanese Characters

Vadivel Murugesan
Greenhorn

Joined: Jul 19, 2008
Posts: 11
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
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.


Android appsImageJ pluginsJava web charts
Vadivel Murugesan
Greenhorn

Joined: Jul 19, 2008
Posts: 11
Hi,

Thanks for response.

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
Yes, that won't work.
Vadivel Murugesan
Greenhorn

Joined: Jul 19, 2008
Posts: 11
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.

Thanks in advance
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35220
    
    7
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.
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Java String does not recognize Japanese Characters
 
Similar Threads
How to write single byte and double byte characters on pdf using java api(iText)
Display an array in a swing type box
Problem With Algorithm Involving Recursion and String Manipulation
Need Help in parsing Japanese SHIFT JIS Characters in Java
Extracting characters from a String