Home >Web Front-end >JS Tutorial >The solution to the Chinese garbled value passed in js url_javascript skills

The solution to the Chinese garbled value passed in js url_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:41:331065browse

In websphere, url=encodeURI(encodeURI(url)) is used; //Used encodeURI twice and the test was successful. The first conversion was not attempted.
Processing method one.
js program code: url=encodeURI(url); note that it is the entire URL
Server-side code: String linename = new String(request.getParameter("name").getBytes("ISO-8859-1") ,"UTF-8");
Processing method two.
js: var url="name=" name;
url=encodeURI(encodeURI(url)); //Used 2 times encodeURI
window.location = "/inner/line/ line.jsp?" url;
Server-side code:
String linename = request.getParameter(name);
//java: Character decoding
linename = java.net.URLDecoder.decode(linename , "UTF-8");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn