Unicode value for your text

 

Following code demonstrate how to get unicode value for your text

public static String getUnicodeText(String original)
{
String unicode=””;
String temp=””;
//Loop through original string and convert each character to unicode equivalent
for( char c : original.toCharArray() ){
temp=Integer.toHexString(c).toUpperCase();
//We do not want to convert space
if(temp.equals(“20″))
{
unicode+=” “;
}
else
{
//For symmetry we will keep unicodes of length 4
while(temp.length()<4)
{
temp=”0″+temp;
}
//Append \\u to let compiler know it is unicode
unicode+=”\\u”+temp;
}
}
//return final unicode string created
return unicode;
}