jsp文件:webiURL = "openDocument.jsp?" +
               "iDocID=" + iDocID +"&token=" + token+"&user="+user+"&path="+docPath;
     response.sendRedirect(webiURL);docPath是中文内容接受是js:var user =getUser(window.parent.location.search);
alert(encodeURI(window.parent.location.search));alert提示的path内容是乱码:path=QGR01s.%2507%2507%25C5%25B5
很郁闷

解决方案 »

  1.   

    别用response.sendRedirect(webiURL);
    用表单的SUBMIT();
    或是window.location = url;
      

  2.   

    试试var user =getUser(window.parent.location.search);
    var s=unescape(encodeURI(window.parent.location.search).replace(/\\\\u/g,'%u'));
    alert(s)
      

  3.   


    这个方法不行  还是乱码
    看来在URL里显示中文 比较的不容易啊
      

  4.   

    http://blog.csdn.net/xuchanghao/archive/2009/01/07/3724008.aspx
    先解码,再还原
      

  5.   

    webiURL = "openDocument.jsp?" +"iDocID=" + encodeURIComponent(iDocID) +"&token=" + encodeURIComponent(token)+"&user="+encodeURIComponent(user)+"&path="+encodeURIComponent(docPath);
    另外在接受的一方处理的时候也要转换
    不知道你用的是什么 我用的是java 在action里处理的时候
    response.setContentType("text/xml"); 
    response.setCharacterEncoding("utf-8");
    List list = site.getCity(new String(((String)request.getParameter("pro")).getBytes("ISO-8859-1"),"utf-8"));
      

  6.   

    使用什么函数编码的使用对应的函数解码
    encodeURIComponent--decodeURIComponent
    encodeURI--decodeURI
    escape--unescape
      

  7.   

    在head标签里加
    <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
    试试
      

  8.   

    webiURL = "openDocument.jsp?" +
                   "iDocID=" + iDocID +"&token=" + token+"&user="+user+"&path="+docPath;
    将所有参数用escape先转化为16进制,再将参数用encodeURI编码
    结果页面再使用unescape使其可读
    具体如下:
    webiURL = "openDocument.jsp?" +
     "iDocID=" + encodeURI(escape(iDocID)) +"&token=" + encodeURI(escape(token))+"&user="+encodeURI(escape(user))+"&path="+encodeURI(escape(docPath));
    试试,做项目时遇到过,就这样处理可以了,不知道楼主这样用可不可以
      

  9.   

    木有用过JSP,楼主可以参考一下此文:如何保证JavaScript和Asp、Php等后端程序间传值编码统一 
      

  10.   

    URL 传值时,需要进行 URI 编码。
    为了方便 JavaScript 读取,你还要使用 UTF-8 字符集.import java.net.URLEncoder;public String uri(key, value) {
        return java.net.URLEncoder.encode(key,"UTF-8")+"="+java.net.URLEncoder.encode(value, "UTF-8") + "&";
    }webiURL = "openDocument.jsp?" + uri("iDocID", iDocID) + uri("token", token) +
    uri("user", user) + uri("path", path);
    response.sendRedirect(webiURL);// js 读取
    function getRequest(key) {
    var regex = new RegExp("[?&]" + encodeURIComponent(key) + "\\=([^&#]+)");
    var value = (location.search.match(regex)||["",""])[1];
    return decodeURIComponent(value);
    }
    var path = getRequest("path");
    alert(path);
      

  11.   

    乱码是编码格式不同,数据库、页面要统一。要使用同一字符集。常用utf-8
      

  12.   

    将带参数的URL encodeURI 一下,然后在接收参数的地方再decodeURI一下就OK了
    经过验证的,ie,火狐,谷歌都行