Convert into Unicode(uxxxx) format ??
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Chow
Posted On:   Wednesday, September 4, 2002 03:05 AM


			
Hello,

Would you please to teach me how I can convert
a String into Unicode form(uxxxx) in Java?



Best regards,
Eric

Re: Convert into Unicode(uxxxx) format ??

Posted By:   Stephen_Ostermiller  
Posted On:   Friday, October 11, 2002 01:57 PM

If you are translating properties files that require this conversion you should use software that lets you type the characters you need and automatically saves the properties files in the correct format:

http://ostermiller.org/attesoro/

Re: Convert into Unicode(uxxxx) format ??

Posted By:   Rob_Eamon  
Posted On:   Wednesday, September 4, 2002 10:38 AM

Here's a little code snippet you can try:
String zeroPad = "000";
String s = "abc
";
String u = "";
for(int i=0; i{
String n = Integer.toHexString((int)s.charAt(i));
u += "\u" + zeroPad.subString(0, 4-n.length()) + n;
}
System.out.println(s);
System.out.println(u);

hth
About | Sitemap | Contact