Home > Backend Development > PHP Tutorial > php中utf16be编码转换成utf八可行吗

php中utf16be编码转换成utf八可行吗

WBOY
Release: 2016-06-13 12:17:46
Original
1396 people have browsed it

php中utf16be编码转换成utf8可行吗?
utf16be的数据要转换成utf8数据(直接当成gbk转换utf-8中文正常,字母不正常),有什么方式可用吗?网上查了没有找到。
------解决思路----------------------

$text = iconv('utf-16be', 'utf-8', $text);
Copy after login


utf16be 就是 ucs-2,两字节高位在前编码方式

如果你当成gbk转换utf-8正常,应纯属巧合
------解决思路----------------------
可以,用iconv 或mb_convert_encoding函数

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