String  kk=new String(request.getParameter("image").getBytes("ISO-8859-1"),"gb2312");

解决方案 »

  1.   

    你的环境可能默认的是iso-8859-1,如果环境默认编码是gbk就没有问题了
    跟你的head提交上去的没有关系,到你的环境中会重新编码
      

  2.   

    String  kk=new String(request.getParameter("image").getBytes("ISO-8859-1"),"gb2312");
      

  3.   

    request.setCharacterEncoding("GB2312");
      

  4.   

    public String toChinese(String strValue){
       try{
            if(strValue==null)
                    return null;
                 else
                 {
                    strValue = new String(strValue.getBytes("ISO8859_1"), "GBK");
                    return strValue;
                  }
             }
             catch(Exception e){
                  e.printStackTrace();
                  return null;
             }   }你把这个方法封装到你的BEAN中,就可以直接调用了
      

  5.   

    String  yy=new String(request.getParameter("image").getBytes("ISO-8859-1"),"gb2312");
    你也可以写一个函数,再调用它就行的!!
    <%!
     private String strrequest(String input){
     if(input!=null){
     
     try   { char ch=' ';
    StringBuffer buf=new StringBuffer(input.length()+6);
    if(input==null || input.length()==0)return input;
    for(int i=0 ;i<input.length(); i++){
      ch=input.charAt(i);  
     if(ch==13) buf.append("");
     if(ch=='<')buf.append("&lt;");
    else if(ch=='>')buf.append("&gt;");
    else if(ch=='\'')buf.append("&acute;");
    else if(ch=='\"')buf.append("&quot;");
    else if(ch==' ')buf.append("&nbsp;");
    else
    buf.append(ch);
    }
    input=buf.toString();     byte[] b_inputtemp=input.getBytes("8859_1");
     String temp=new String(b_inputtemp,"gb2312"); 
         return temp;
       }
       catch(Exception e){  
         return input;
     }
    }
    else
    return "";
    }
    %>
    然后你就调用它就行的。
    String yy=strrequest(request.getParameter("image"));这样就行了,你自己试试看。