<%@page contentType="text/html;charset=GB2312"%>

解决方案 »

  1.   

    用getBytes()函数,很多书中都有介绍的。希望你尽快解决!:)
      

  2.   

    用getBytes把所有的字符都转成ISO8859_1应该没问题。
      

  3.   

    我用的是函数转换,转换函数如下:
       public String encode(String str)
        {
          String s = "null";
         try
          {
            String temp_p = str;
        byte[] temp_t = temp_p.getBytes("ISO8859-1");
        String temp = new String(temp_t,"GBK");//GBK处我还用过GB2312等其他中文编码
        s = temp;
          }
         catch(Exception e)
          {
            System.out.println (e.toString()); 
          }
          return s;
       }
      

  4.   

    其实,最简单的解决方法是在连接db时指定参数,如下:jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GB2312
      

  5.   

    <%@ page contentType="text/html; charset=GBK"%>
    <% request.setCharacterEncoding("GBK"); %>
    jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GB2312我是这样的