从jsp提交来的字符串
String str = new String(request.getParameter("str").getBytes("iso-8859-1"),"GB2312");

解决方案 »

  1.   

    取request值之前先用request.setCharacterEncoding("GBK");
      

  2.   

    请注意,在向数据库插入数据时把字符转换成iso-8859-1,一般来说是不需要转换的,因为页面之间传输数据时都是应用iso-8859-1编码
    "INSERT INTO designf_file (desf_id,desf01,desf02,desf03) VALUES ('"+TimeN+"','"+desf01+"','"+desf02+"','"+desf03+"')"
      

  3.   

    我楼上是Tomcat4.0以前普遍的做法,如果我的不能使用就用我楼上的
      

  4.   

    String str_no1=new String(request.getParameter("str_no1").getBytes("ISO8859_1"))
    是转换字符集
    request.setCharacterEncoding("GBK");
    是设定字符过滤器两种方法都可以,最好不要一起使用,以免出现混乱