1。先打印出來:
System.out.println(testString);
2。這一段出現(xiàn)了亂碼,那么不妨用窮舉法猜測一下它的實(shí)際編碼格式。
System.out.println(new String(testString.getBytes("ISO-8859-1"),"gb2312"));
System.out.println(new String(testString.getBytes("UTF8"),"gb2312"));
System.out.println(new String(testString.getBytes("GB2312"),"gb2312"));
System.out.println(new String(testString.getBytes("GBK"),"gb2312"));
System.out.println(new String(testString.getBytes("BIG5"),"gb2312"));
3。進(jìn)行相應(yīng)的處理。