String iso8859 = new String(sb.toString().getBytes("iso8859-1"));
String gbk = new String(sb.toString().getBytes("gbk"));
String utf8 = new String(sb.toString().getBytes("utf-8"));
if(iso8859.equals(sb.toString())){
System.out.println("iso8859");
}else if(gbk.equals(sb.toString())){
System.out.println("gbk");
}else if(utf8.equals(sb.toString())){
System.out.println("utf8");
}
java 判断字符串编码
最新推荐文章于 2024-09-08 11:09:43 发布