In the process of using JSP,
Vibram FiveFingers Kso Trek, maximum people a headache is the question of Chinese garbage problem, the following is encountered in software evolution and solutions to garbage problems. 1, JSP pages garbled
this garbage should be no reason is specified in the page using the character set encoding, the solution: starting area at the peak of the page with the following code to clarify the character set encoding.
2, the database garbled
this waste makes you insert a database of Chinese garbled, or read the display is garbled, the solution is as usual:
joining the database connection string in the character set encoding
String Url = setContentType (dissimilar page, the situation will be garbled,
Vibram FiveFingers Flow, the solution is as usual:
parameters when the coding parameters,
Women Vibram FiveFingers Sprint, such as
RearshRes.jsp? keywords = br> and then receiving the parameter sheet using the emulating statement to receive
keywords = new String (request.getParameter (br> get garbled transmission parameters
============
2, login_do.jsp
out.println (temp);
%>
6, in the ajax in Chinese garbled pass url parameters to pay consideration to the place:
sample, the following method:
/ / add type function
feature addSort () {
var name = document.getElementById (. amount; / / get the text carton with id name value (in Chinese)
if (name ==; cautious (; return disloyal;
}
var url = ; / / This is the Chinese label parameter
createXMLHttpRequest ();
XMLHttpReq.onreadystatechange = AddStateChange;
XMLHttpReq.open (/ / transmitted at post
XMLHttpReq.setRequestHeader ((url);
}
============
in the servlet to obtain parameter when:
/ / solve the url Chinese garbled key parameter here,
Women FiveFingers Performa, because post method to submit data in the default symbol encoding is utf-8,
/ / if the backdrop is gb2312 alternatively additional encoded file will be garbled, so there should be a request parameter is set apt utf-8
/ / Even although you jsp page is c
request.setCharacterEncoding (br> answer.setContentType (,
Vibram FiveFingers Kso, either show natural