ios 端如何 进行同样的unicode 解码 转码, 不太懂Java,希望大神贴上ios unicode代码转码解码public static String string2Unicode(String string) { StringBuffer unicode = new StringBuffer(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); unicode.append("\\u" + Integer.toHexString(c)); } String str = unicode.toString(); return str.replaceAll("\\\\","0x");}public static String unicode2String(String unicode) { String str = unicode.replace("0x", "\\"); StringBuffer string = new StringBuffer(); String[] hex = str.split("\\\\u"); for (int i = 1; i < hex.length; i++) { int data = Integer.parseInt(hex[i], 16); string.append((char) data); } return string.toString();}
添加回答
举报
0/150
提交
取消