具体操作:

String destination ="testå¾·ç\u008E\u009B西äº\u009A";
try {
if(destination.equals(new String(destination.getBytes("iso8859-1"), "iso8859-1"))){
destination=new String(destination.getBytes("iso8859-1"),"utf-8");
System.out.println(destination);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

结果:

【java】判断某段字符串的编码方式,并按照新的编码方式输出-LMLPHP

04-28 07:10