byte[] tmpbyte1= str.getBytes("ISO8859_1");
newstrword = new String (tmpbyte1);

解决方案 »

  1.   

    将你原来的
    String name=request.getParameter("username");
    该为:
    String name=new String(request.getParameter("username").getBytes("iso-8859-1"));
    即可
    你试试?
      

  2.   

    我用的是tomcat5.0+jdk1.4
    多谢各位,让我试一下。
      

  3.   

    还有一种方便的方法:
     
       try {
                request.setCharacterEncoding("gb2312"); //对request进行硬编码
            }
            catch(java.io.UnsupportedEncodingException uee) {
                uee.printStackTrace(System.out);
            }
    很好用的,试试看