Android examples for java.lang:String Unicode
Convert string To Unicode
public class Main { public static String stringToUnicode(String strText) throws Exception { char c;/*from w ww . j a va 2 s . c o m*/ String strRet = ""; int intAsc; String strHex; for (int i = 0; i < strText.length(); i++) { c = strText.charAt(i); intAsc = (int) c; strHex = Integer.toHexString(intAsc); if (intAsc > 128) { strRet += "\\u" + strHex; } else { strRet += "\\u00" + strHex; } } return strRet; } }