处理中文乱码(新,比较万能)(encodeURI)

$.ajax({
        type:"GET",
         url:encodeURI(encodeURI("AJAXXmlServer")),
        data:encodeURI(encodeURI("username="+username)),
        dataType:"xml"  ,
        success:callback
    });

1,页面端在传地址的时候用两次    encodeURI(encodeURI("username="+username));
   String name=request.getParameter("username");
2  服务器端:URLDecoder.decode(name,"UTF-8");

    //encodeURI("username="+中)   ==="username=%E4%B8%AD"
    //encodeURI(encodeURI("username="+中)) ======"username=%25E4%25B8%25AD"

你可能感兴趣的:(Ajax,xml)