jsp表单提交到数据库的数据(中文字符)读取后就变成了乱码

public static String toChinese(String strvalue)
{
try{
if(strvalue==null)
{
return null;
}
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
return strvalue;
}
}
catch(Exception e)
{
return null;
}

}


==================================================
然后在setUsername方法中:
public void setUsername(String c)
{
this.username=类名.toChinese(c);
}

你可能感兴趣的:(jsp表单提交到数据库的数据(中文字符)读取后就变成了乱码)