request.getCharacterEncoding("UTF-8");
不知是不是问这个

解决方案 »

  1.   

    String newString= new String(a.getBytes("GB2312"),"UTF-8");是这个意思么?
      

  2.   

    在你接受处理的时候
    先写 request.setCharacterEncoding("UTF-8");页面最好也是以utf-8编码显示
      

  3.   

    String newString= new String(a.getBytes("GB2312"),"UTF-8");
      

  4.   

    serlvetRequest.setCharacterEncoding("UTF-8");
      

  5.   

    加一个Filer servlet 也可以。
      

  6.   

    public String ex_chinese(String str){
         if(str==""){
         str  ="null" ;
         }
         else{
             try {
            str = new String(str.getBytes("GB2312"),"UTF-8");
             }
             catch (Exception ex) {
     System.out.print(ex);
             }
         }
         return str ;
      }
    试试
      

  7.   

    两种方法:1.request.setCharacterEncoding("编码");
             2.String trans(String 参数)
                   {
                   String result = null;
                   byte temp [];
                   try
                   {
                           temp=参数.getBytes("编码");
                          result = new String(temp);
                    }
                    catch(UnsupportedEncodingException e)
                    {
                            System.out.println (e.toString());
                    }
    return result;
    trans(request.getParameter("参数"))