MYSQL5.0的,通过SERVLET保存数据,中文全是乱码!
在Serlvet中,试了       request.setCharacterEncoding("GBK");和
        request.setCharacterEncoding("UTF-8");
试了
public static String toChinese(String s)
throws UnsupportedEncodingException {
if (s == null || s.trim().length() == 0) {
return null;
} else {
byte aa[] = s.getBytes("ISO-8859-1");
String ss = new String(aa, "GBK");
return ss;
}
}
也试了:
    public static String ex_chinese(String s)
    {
        if(s == null)
            s = "";
        else
            try
            {
                s = new String(s.getBytes("iso-8859-1"), "gb2312");
            }
            catch(Exception exception) { }
        return s;
    }保存到库里还试乱码!!!!真是晕了!!