保存时间:2026/4/2 11:17:10
public class Gb2312ToUnicodeExample {
public static void main(String[] args) {
String gb2312Str = "\uD6D0"; // “中”字的GB2312编码
try {
byte[] bytes = gb2312Str.getBytes("GB2312");
String unicodeStr = new String(bytes, "Unicode");
System.out.println("GB2312编码的字符串转换为Unicode后的结果: " + unicodeStr);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}