public String gbk2utf8(String str) throws UnsupportedEncodingException {
byte[] bytes = str.getBytes();
return convert(bytes, "GBK", "UTF-8");
}
public String convert(byte[] datas, String oldCharset,
String newCharset) throws UnsupportedEncodingException {
return new String(new String(datas, oldCharset).getBytes(newCharset), newCharset);
}
万能转码
最新推荐文章于 2024-10-16 11:25:49 发布