乱码问题解决方法总结

乱码问题:

 页面中有乱码问题时,servlet中解决方案:

  1. response.setContentType("text/html;charset=gbk");  
  1. request.setCharacterEncoding("GBK");  

在JSP中解决方案:

  1. <%@ page contentType="text/html;charset=gb2312"%>  

解决post方式提交内容的乱码:

  1. request.setCharacterEncoding("GBK");  

解决get方式提交内容的乱码:修改server.xml àURIEncoding="GBK"

解决<jsp:param name="user" value="<%=string%>"/>,url地址包含中文参数乱码问题:

  1. <%request.setCharacterEncoding("GBK");%>
posted @ 2012-01-19 16:06  王爵的技术博客  阅读(352)  评论(0)    收藏  举报

我的技术博客:https://biezhi.me

Github:https://github.com/biezhi 

微博:http://weibo.com/u/5238733773

Twitter:https://twitter.com/biezhii