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.
The moose likes I/O and Streams and the fly likes How can I get Unicode String of a String? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How can I get Unicode String of a String?" Watch "How can I get Unicode String of a String?" New topic
Author

How can I get Unicode String of a String?

Blood Bigsoon
Greenhorn

Joined: Jun 03, 2001
Posts: 13
Hi,I write a program now,but I can't get the right unicode string of the string,who knows that?Pls help me!Thx
eg:
String str = "abcd";
System.out.println(new String(str.getBytes("Unicode"));//But I can't get the right Unicode of the String if user this.
Sumeet Gaikwad
Ranch Hand

Joined: Mar 07, 2002
Posts: 37
Dear Blood,
I am not sure what you want with the unicode String? But if you want to read the unicode from the file then use the following code.

Hope this help.


Sumeet Gaikwad<br />SCJP, SCWCD<br />-----------------------------------------------------------------------------------<br />Nothing is impossible because it spells... I M Possible !!!
Blood Bigsoon
Greenhorn

Joined: Jun 03, 2001
Posts: 13
I got he right way.I switch the byte[2] and byte[1].sigh
 
Have you checked out Aspose?
 
subject: How can I get Unicode String of a String?
 
It's not a secret anymore!