给你写个过滤器。你试试。public class ChStr { public static String toChinese(String strvalue) { try { if (strvalue == null) { return "";} else { strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK").trim();return strvalue;} } catch (Exception e) { return ...
ISO8859-1转GBK后好像数据丢失了。但是如果2,3这两步之间交互用的UTF-8就不会出现问题,再转回来初始数据也一样,如下 (1)--- String pwdString = new String(byteUtf8,"ISO8859-1"); (2)--- byte[] gg = pwdString.getBytes("UTF-8"); (3)--- String ggg = new String(gg,"UTF-8"); (4...
ISO8859-1转GBK后好像数据丢失了。但是如果2,3这两步之间交互用的UTF-8就不会出现问题,再转回来初始数据也一样,如下 (1)--- String pwdString = new String(byteUtf8,"ISO8859-1"); (2)--- byte[] gg = pwdString.getBytes("UTF-8"); (3)--- String ggg = new String(gg,"UTF-8"); (4...
Understanding ISO-8859-1 / UTF-8 Why should you care about this mapping? This mapping helps you to understand which encoding should be used for decode. If you see byte 0xEF (ï), you should probably consider using ISO-8859-1.