你jsp段是不是加了
<meta http-equiv="Content-Type" content="text/html; charset='gb2312'>
这样的语句,
这样语句的功能会帮你自动再做一次转化,就会错误

解决方案 »

  1.   

    我已经把文件开头的哪个设置为charset=gbk了
    这会从数据库里取的是中文了,但在整个页面上显示的全都是乱码了
      

  2.   

    不如试试utf-8的编码格式。什么数据库?
      

  3.   

    <meta http-equiv="Content-Type" content="text/html; charset='utf-8'>
      

  4.   

    s9[j][1]=new String(se.getString(2).getBytes("iso-8859-1"));试试改这里的编码格式
      

  5.   

    public static String toChinese(String str) {
            if (str == null) {
                return str;
            }
            try {
                str = new String(str.getBytes("ISO8859_1"), "gb2312");
            } catch (Exception e) {
                e.printStackTrace();
            }
            return str;
        }
      

  6.   

    当从表单获取数据的时候用以上方法处理一下,然后入库。
    读出来的时候不需修改。
    页面最顶端加:
    <%@ page contentType="text/html; charset=GBK" %>
    屡试不爽
      

  7.   

    public static String toChinese(String pstrWord) throws java.io.UnsupportedEncodingException
    {
    if ((pstrWord != null) && (!pstrWord.equals("")))
    {
    pstrWord = new String(pstrWord.getBytes("ISO8859_1"), "GBK");
    return pstrWord;
    }
    return "";
    }
    public static String toReChinese(String pstrWord) throws java.io.UnsupportedEncodingException
    {
    if ((pstrWord != null) && (!pstrWord.equals("")))
    {
    pstrWord = new String(pstrWord.getBytes("GBK"), "ISO8859_1");
    return pstrWord;
    }
    return "";
    }
    用这两个方法试试,其中一个肯定行,要用到时调用一下就行了