$.getJSON()方法请求服务器的json数据(有中文),返回到浏览器页面是乱码,怎么办呢?

原因是浏览器编码和服务器里的json数据编码不一致,(使用eclipse编辑器时:)

1.对着项目右键,properties,将text file encoding,改为utf-8.这时访问页面,发现还是乱码。我们还需要一步。

2.对着json文件,右键,properties,将text file encoding,改为utf-8.在此访问,发现不是乱码了,中文正常显示。

 

参考:http://www.cnblogs.com/westward/p/5744874.html

posted on 2017-07-19 11:48  JAVA_STUDYER  阅读(1165)  评论(0编辑  收藏  举报