In the process of using JSP, maximum human a headache namely the question of Chinese garbage problem, the emulating namely encountered in software evolution and solutions to garbage problems. 1,
Vibram Five Fingers, JSP pages garbled
this garbage should be not reason is specified in the page using the character set encoding,
Women Vibram FiveFingers Sprint, the solution: starting place at all times the page with the following code to specify the character set encoding.
2, the database garbled
this garbage makes you insert a database of Chinese garbled,
Women FiveFingers Performa, or read the exhibit is garbled, the solution is It’s about time:
adding the database articulation string in the role set encoding
String Url = setContentType (distinct page, the position will be garbled, the solution is consist in ...:
parameters when the coding parameters, such as
RearshRes.jsp? keywords = br> and then receiving the parameter page using the following expression to receive
keywords = new String (request.getParameter (br> get garbled transportation parameters
============
2, login_do.jsp
6, in the ajax in Chinese garbled pass url parameters to pay attention to the place:
example, the following method:
/ / add type feature
function addSort () {
var name = document.getElementById (. amount; / / get the txt carton with id name merit (in Chinese)
if (label ==; cautious (; return false;
}
var url = ; / / This is the Chinese name parameter
createXMLHttpRequest ();
XMLHttpReq.onreadystatechange = AddStateChange;
XMLHttpReq.open (/ / transmitted along post
XMLHttpReq.setRequestHeader ((url);
}
============
in the servlet to get parameter when:
/ / solve the url Chinese garbled opener parameter here,
Vibram FiveFingers Flow, because post method to submit data in the default character encoding is utf-8,
Vibram FiveFingers New Styles,
/ / whether the background is gb2312 alternatively additional encoded file will be garbled, so there should be a apply parameter is set to utf-8
/ / Even whereas you jsp page is c
request.setCharacterEncoding (br> answer.setContentType (,
Vibram Fivefinger, both show regular