URI传中文参数乱码解决
前端两次encodeURL
//产生查询的url
function generateUrl() {
var timeToStrt = scheduler.date.date_to_str("%Y-%m-%d");
var url = "data.jsp?name=" + (jQuery("#searchName").val()) + "&meetingType=" + jQuery("#searchMeetingType").val() +
"&meetingSectype=" + (jQuery("#searchMeetingSectype").val()==null?"":jQuery("#searchMeetingSectype").val()) + "&searchDept=" + jQuery("#searchdept").val() +
"&beginDate=" + timeToStrt(scheduler._min_date) + "&endDate=" + timeToStrt(scheduler._max_date) + "&searchSelfDepartment=" + jQuery("#searchselfdepartment").val() +
"&userid=" + "<%=userid%>";
return encodeURI(encodeURI(url));
}
后台解析
String name=Util.null2String(request.getParameter("name"));
name = URLDecoder.decode(name,"utf-8");