标签:static bytes art catch except str style enc details
是
public static String getEncoding(String str){ String encoding = "UTF-8"; try { if (str.equals(new String(str.getBytes(),encoding))) { return encoding; } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } encoding = "GBK"; try { if (str.equals(new String(str.getBytes(),encoding))) { return encoding; } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } encoding = "ISO-8859-1"; try { if (str.equals(new String(str.getBytes(),encoding))) { return encoding; } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } encoding = "GB2312"; try { if (str.equals(new String(str.getBytes(),encoding))) { return encoding; } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
转自:https://blog.csdn.net/yueloveme/article/details/77929269
标签:static bytes art catch except str style enc details
原文地址:https://www.cnblogs.com/cailijuan/p/9059665.html