//unicode转换为中文
public static String AsciiToChineseString(String s) {
char[] orig = s.toCharArray();
byte[] dest = new byte[orig.length];
for (int i=0;i<orig.length;i++)
dest[i] = (byte)(orig[i]&0xFF);
try {
ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312");
return new String(toChar.convertAll(dest));
}
catch (Exception e) {
System.out.println(e);
return s;
}
}
public static String AsciiToChineseString(String s) {
char[] orig = s.toCharArray();
byte[] dest = new byte[orig.length];
for (int i=0;i<orig.length;i++)
dest[i] = (byte)(orig[i]&0xFF);
try {
ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312");
return new String(toChar.convertAll(dest));
}
catch (Exception e) {
System.out.println(e);
return s;
}
}
String a = "a你好,Jack"
String b = new String(a.getBytes("UTF-16BE"), "UTF-16BE")