---------------------------------------------------------------------------
public static String getString(String str) {
String s = null;
try {
s = new String(str.getBytes("GBK"), "UTF-8");
} catch (Exception ex) {
ex.getMessage();
}
return s;
}
-----------------------------------------------------------------------------
怎么存到数据库里的一部分是乱码,一部分不是乱码(如,“我晕”就 不是乱码,“我晕倒”那个“倒”就是乱码,还有“?”号全是两个“?”)
我还试了s = new String(str.getBytes("UTF-8"), "GBK");但是还是不行,请那个高手帮忙给指点一下
public static String getString(String str) {
String s = null;
try {
s = new String(str.getBytes("GBK"), "UTF-8");
} catch (Exception ex) {
ex.getMessage();
}
return s;
}
-----------------------------------------------------------------------------
怎么存到数据库里的一部分是乱码,一部分不是乱码(如,“我晕”就 不是乱码,“我晕倒”那个“倒”就是乱码,还有“?”号全是两个“?”)
我还试了s = new String(str.getBytes("UTF-8"), "GBK");但是还是不行,请那个高手帮忙给指点一下
试试
--------------------------------------------
s = new String(str.getBytes("iso-8859-1"), "GBK");
s = new String(str.getBytes("UTF-8"), "GBK");
----------------------
这样的我都试了,存到数据库的还是乱码,很是郁闷。