java javascript jsp的url提交带中文参数时后台取到的是乱码问题的解决

jsp:
document.forms[0].action = "updateUsers.do?editUTxt=" + encodeURI(editUTxt) ;//post提交 


带有中文的变量用encodeURI包住

后台可以直接取,也可以解码后再取

String tempEditUTxt = request.getParameter("editUTxt");
			
System.out.println(tempEditUTxt );
try {			System.out.println(java.net.URLDecoder.decode(tempEditUTxt ,"UTF-8"));
} catch (UnsupportedEncodingException e) {
	e.printStackTrace();
}  


黑色头发:http://heisetoufa.iteye.com/

你可能感兴趣的:(JavaScript,java,jsp,.net)