怎么把数据从GB2312转换成UTF-8

WBOY
Release: 2016-06-13 11:54:33
Original
1428 people have browsed it

如何把数据从GB2312转换成UTF-8
我使用了iconv和mb_convert_encoding两个函数都试了,然后发现结果是一样的,都会出现各种问题,不是哪里少字了就是直接错误,请问大神怎么解决啊
------解决方案--------------------
gbk 的数据插入到 utf8 的表,只需在插入前执行一次 mysql_query('set names gbk'); 就可以了

mysql_query('set names gbk');
这条指令的作用是:通知 mysql 现在用 gbk 字符集进行操作
转码的工作由 mysql 自己完成

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