This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I have a problem to print string value in utf-8 format. The Given below function produce following outputs.
String out="Raghu"; System.out.println (new String(out.getBytes("utf-16"),"UTF-8")); gives ?? System.out.println (new String(out.getBytes("utf-16"),"UTF-16")); gives aRhg System.out.println (new String(out.getBytes("utf-8"),"UTF-16")); gives ??
My problem is how to convert string values in utf-8 to utf-16 and utf-16 to utf-8. Could any one enlighten me?
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
In addition, if you're looking at the output in a terminal window, the terminal may not understand Unicode, and thus be unable to display it properly. In that case, write the output to a file and look at the result in a Uniode-capable editor.