public static String UnicodeToChinese(String s) {
try {
if (s == null || s.equals(""))
return "";
String newstring = null;
newstring = new String(s.getBytes("ISO8859_1"), "gb2312");
return newstring;
} catch (UnsupportedEncodingException e) {
return s;
}
}
public static String ChineseToUnicode(String s) {
try {
if (s == null || s.equals(""))
return "";
String newstring = null;
newstring = new String(s.getBytes("gb2312"), "ISO8859_1");
return newstring;
} catch (UnsupportedEncodingException e) {
return s;
}
}??
寫進數(shù)據(jù)庫時用ChineseToUnicode()方法進行編碼,讀出來的時候用UnicodeToChinese()方法進行解碼既可
?