我的json含有中文传到前台就全变问号了。
我的json含有中文传到前台就全变问号了。
controller得到的json是{"total":8,"limit":3,"order":"asc","offset":0,"rows":[{"content":"adadad","id":3,"user_name":"aaa","title":"adad","creattime":"2015-03-31 11:25:40"},{"content":"adadad","id":4,"user_name":"aaa","title":"adad","creattime":"2015-03-31 11:27:11"},{"content":"311313","id":1,"user_name":"系统管理员","title":"233","creattime":"2015-03-31 10:21:51"}]}
到了页面,火狐firebug看到的json就是
{"total":8,"limit":3,"order":"asc","offset":0, "rows":[{"content":"adadad","id":3,"user_name":"aaa", "title":"adad","creattime":"2015-03-31 11:25:40"},{"content":"adadad","id":4, "user_name":"aaa","title":"adad","creattime":"2015-03-31 11:27:11"}, {"content":"311313","id":1,"user_name":"?????","title":"233", "creattime":"2015-03-31 10:21:51"}]}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
后台写了 response.setCharacterEncoding("UTF-8");
页面有<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
也不行
数据库和页面的字符编码要一致
字符编码,设置没有
解决了,我在解决
spring 3.2 MVC 406 Not Acceptable
的时候这个问题顺便解决了
更新了jar包解决的 jackson-1.9.4.jar json-lib-2.4-jdk15.jar ezmorph-1.0.6.jar