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
Release: 2016-05-16 18:41:33
Original
1069 people have browsed it

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");

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template