是你的页面上的charset没有设。
<meta content='text/html; charset=ISO-8859-1' http-equiv=Content-Type>

解决方案 »

  1.   

    这个问题涉及到字符集的转换,比较复杂,与你的web server操作系统的版本(那个语言的版本),database, 提交的方式等都有关系。需要进行试验,将录入的数据进行转码,从数据库中取出数据后可能也要转码。方法是:
    String s = new String(s.getByte("gb2312"), "8859-1")
    其中"gb2312","8859-1"试编码类型,两种类型颠来倒去,总归能有一种是正确的。
      

  2.   

    /**
     * 将数据从数据库中取出后转换
     *
     * @param strVal 要转换的字符串
     * @return 从“GBK”到“ISO8859_1”得到的字符串
     */
        public static final String toISO(String strVal)
        {
            try
            {
                if(strVal==null)
                {
                    return "";
                }
                else
                {
    strVal=new String(strVal.getBytes("GBK"), "ISO8859_1");
    return strVal;
                }
            }
            catch(Exception exp)
            {
                return "";
            }
        }
    --------------------------------------------------
    /**
     * 在将数据存入数据库前转换
     *
     * @param strVal 要转换的字符串
     * @return 从“ISO8859_1”到“GBK”得到的字符串
     */
        public static final String toChinese(String strVal)
        {
    try
    {
                if(strVal==null)
                {
                    return "";
                }
                else
                {   strVal=strVal.trim();
                    strVal=new String(strVal.getBytes("ISO8859_1"), "GBK");
                    strVal=replace(strVal,"'","''");
                    return strVal;
                }
            }
            catch(Exception exp)
            {
                return "";
            }
        }
     ------------------------------------------
      

  3.   

    你的页面是不是设定了
    <% page contentType="text/html; charset=ISO-8859-1" %>
    如果是这样的话,jre就会将你的中文转化为unicode。
    还是设置成
    <% page contentType="text/html; charset=GBK" %>

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