Home > php教程 > php手册 > PHP编码转换

PHP编码转换

WBOY
Release: 2016-06-13 11:57:10
Original
1103 people have browsed it

SELECT COLLATIONPROPERTY('Chinese_PRC_Stroke_CI_AI_KS_WS', 'CodePage')

返回为936,即GBK编码。

936 简体中文GBK
950 繁体中文BIG5
437 美国/加拿大英语
932 日文
949 韩文
866 俄文
65001 unicode UFT-8

如果字段有中文,PHP文件设置编码为GBK2312,则取数据库信息时没有问题:

print_r($rs["客户编码"]);

如果PHP文件设置编码为utf-8,则会报告错误。

如果非要把php文件的编码设置为utf-8,则需要转换一下编码:

print_r($rs[mb_convert_encoding("客户编码","GBK","UTF-8")]);//打印记录数组

这样就没有问题了。

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template