File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java String does not recognize Japanese Characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 42276
    
  64
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.


Ping & DNS - my free Android networking tools app
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: 42276
    
  64
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
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14268
    
  21

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 8 API documentation
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
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://aspose.com/file-tools
 
subject: Java String does not recognize Japanese Characters