//汉字转GBK
public static String toGBK(String source) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
byte[] bytes = source.getBytes("GBK");
for(byte b : bytes) {
sb.append("%" + Integer.toHexString((b & 0xff)).toUpperCase());
}
return sb.toString();
}
来源:CSDN
作者:loading....
链接:https://blog.csdn.net/qq_40996012/article/details/103712291