Apache Tomcat 的默认编码是ISO8859-1,在与数据库联系时,需要转变一下。
  加 new String( 字段.getBytes("ISO8859_1"),"gb2312") 就可以了。
  试试看。

解决方案 »

  1.   

    同意楼上的看法,不过,有种比较好的方法是在联数据库的时候指定编码
    String sConnStr="jdbc:mysql://localhost/test?user=xxx&password=yyy&useUnicode=true&characterEncoding=8859_1";
      

  2.   

    //向数据库中存储中文
       public String getStr(String str)
      {
         try
            {
              String temp_p=str;
              byte[] temp_t=temp_p.getBytes("ISO8859_1");
              String temp=new String(temp_t);
              return temp;
             }
          catch(Exception e)
             { return "null";}
      }
    //从向数据库中提取中文   public String getStr1(String str)
      {
         try
            {
              String temp_p=str;
              byte[] temp_t=temp_p.getBytes("GBK");
              String temp=new String(temp_t,"ISO8859_1");
              return temp;
             }
          catch(Exception e)
             { return "null";}
      }
         
    }
      

  3.   

    给你看一篇文章你就知道怎么办了:)
    http://www2.ccw.com.cn/02/0224/c/0224c05_4.asp