解决办法:进行Base64加密解密解决。
Base64Utils:
public class Base64Utils {
/**
* @param bstr
* @return String
*/
public static String encode(byte[] bstr){
return new sun.misc.BASE64Encoder().encode(bstr);
}
/**
* @param str
* @return string
*/
public static byte[] decode(String str){
byte[] bt = null;
try {
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
bt = decoder.decodeBuffer(str);
} catch (Exception e) {
e.printStackTrace();
}
return bt;
}
}
加密:encode()
String s;
Base64Utils.encode(s.getBytes("GBK"));
解密:decode()
String s;
Base64Utils.decode(s);