json传递汉字显示null,该如何处理

WBOY
Release: 2016-06-13 10:03:07
Original
1000 people have browsed it

json传递汉字显示null
echo如果是字母的话正常显示,要是汉字就是null,这个应该怎么处理? 我的默认编码是gb2312 用了一个转换的函数转换成utf-8 测试程序是好用的 但是从数据库里遍历出来的数据就不行了 数据库默认编码是latin1 这个问题应该如何处理

------解决方案--------------------
前两天我也遇到这样的问题了,我用的是Wamp 5.0。
解决方法:
数据库在建立时,“整理”选项要选择utf8_general_ci.
在建立各种表的时候,每条记录的“整理”属性也要选为utf8_general_ci.

问题就解决掉了!
------解决方案--------------------
我来接分
------解决方案--------------------
mysql_set_charset()是用来干嘛的?我搞不明白啊!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!