static public String Code(String str) {
    if (str == null) {
      return str;
    }
    String s = "";
    try {
      s = new String(str.getBytes("ISO-8859-1"), "GBK");    }
    catch (java.io.UnsupportedEncodingException e) {
      System.err.print("error while code converting. ");
    }
    return s;
  }

解决方案 »

  1.   

    request.setCharacterEncoding("GBK"); 
    // 新建一个SmartUpload对象 String type = request.getParameter("type"); 
    type = (type == null)?"":type.trim(); String caption = request.getParameter("caption"); 
    caption = (caption == null)?"":caption.trim(); String description = request.getParameter("description"); 
    description = (description == null)?"":description.trim(); String name = (String)request.getParameter("name"); 
    name = (name == null)?"":name.trim(); 
    这里取得时就为乱码了,发送请求在url里是正常的