public static String to_utf8(String utf8) {
int len = utf8.length();
String[] s = new String[len];
// cn -> unicode
for (int i = 0; i < len; i++) {
char c = utf8.charAt(i);
s[i] = Integer.toString(c, 16);
// System.out.println(c + "\t\\u" + s[i]);
}
// System.out.println();
// unicode -> cn
for (int i = 0; i < len; i++) {
char c = (char) Integer.valueOf(s[i], 16).intValue();
// System.out.println("\\u" + s[i] + "\t" + c);
// System.out.println(c);
utf8 += c;
}
return utf8;
}
转UTF-8
最新推荐文章于 2022-02-25 20:00:37 发布