mvc controller 解析上传的中文数据总是乱码问题
来源:互联网 发布:80卡盟主站域名填什么 编辑:程序博客网 时间:2024/04/29 10:47
1. mysql 数据库表采用utf-8编码;
2. jdbc数据库连接采用utf8:
mysql.url=jdbc\:mysql\://192.168.1.200\:3306/myDB?useUnicode\=true&characterEncoding\=utf8
3. jsp页面采用utf-8编码;
可以用fiddler抓包看看http 请求是否对中文进行了utf8编码;
4.server工程配置 web.xml
<filter>
<description>字符集过滤器</description>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<description>字符集编码</description>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
5. 配置tomcat采用utf8编码:
修改 server.xml 在 connector 后添加属性URIEncoding="UTF-8":
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />
参考:
http://my.oschina.net/u/1010578/blog/387043
http://blog.csdn.net/hongqishi/article/details/7428380
http://blog.csdn.net/cn_gaowei/article/details/6673539
- mvc controller 解析上传的中文数据总是乱码问题
- Spring MVC Controller中解析GET方式的中文参数会乱码的问题
- SPRING MVC上传的中文乱码问题
- Spring MVC Controller中返回json数据中文乱码处理
- Spring MVC Controller中返回json数据中文乱码处理
- Spring MVC Controller中返回json数据中文乱码处理
- Spring MVC Controller中返回json数据中文乱码处理
- Spring MVC Controller中返回json数据中文乱码处理
- JSP中文传到Spring MVC controller乱码问题分析
- spring mvc controller取到的中文参数是乱码
- controller接收前台数据—中文乱码问题
- iOS json解析数据中文出现乱码的问题
- iOS 中json解析数据出现中文乱码的问题
- iOS 中json解析数据出现中文乱码的问题
- iOS中数据解析出现中文乱码的问题
- 【Spring】Spring MVC Controller 参数中文乱码
- Spring MVC - 开发 Controller的特性与乱码问题
- MVC 框架下的中文乱码问题
- Java Calendar使用指南
- 拖拽效果集
- 用JQuery实现全屏banner
- Spring中的注解
- mysql优化
- mvc controller 解析上传的中文数据总是乱码问题
- 数据结构-图
- 我在学习程序中遇到的问题!
- 批量删除Maven中失败的下载项
- Android开发之ExpandableListView: 可展开的ListView
- warning The transaction log file is corrupted.
- Server Tomcat v6.0 Server at localhost was unable to start within 40 seconds.
- 【C++探索之旅】第一部分第十三课:第一部分小测验
- 在Yaf中使用Yar