Here you can find the source of utf8ToUnicode(String inStr)
public static String utf8ToUnicode(String inStr)
//package com.java2s; //License from project: Apache License public class Main { public static String utf8ToUnicode(String inStr) { char[] myBuffer = inStr.toCharArray(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < inStr.length(); i++) { Character.UnicodeBlock ub = Character.UnicodeBlock.of(myBuffer[i]); if (ub == Character.UnicodeBlock.BASIC_LATIN) { sb.append(myBuffer[i]);//from w ww. j av a2 s.c om } else if (ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) { int j = (int) myBuffer[i] - 65248; sb.append((char) j); } else { int chr1 = (char) myBuffer[i]; String hexS = Integer.toHexString(chr1); String unicode = "\\u" + hexS; sb.append(unicode.toLowerCase()); } } return sb.toString(); } }