Treatment method 1.

Js program code: url=encodeURI(url); Notice it's the whole URLCopy the code
Server-side code: String linename =new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8");
Copy the code

Treatment method two.

Js:var url="name="+name;
url=encodeURI(encodeURI(url)); // Use encodeURI twice
window.location = "<%=path%>/inner/line/line.jsp?"+url;
Copy the code
String linename = request.getParameter(name);// Java: character decode
linename = java.net.URLDecoder.decode(linename , "UTF-8");
Copy the code