PHP 如何判断一个汉字是不是 UTF-8 编码

WBOY
Release: 2016-06-06 20:21:49
Original
1664 people have browsed it

PHP 如何判断一个汉字是不是 UTF-8 编码

回复内容:

PHP 如何判断一个汉字是不是 UTF-8 编码

用mb_detect_encoding();

<code>$str = 'áéóú'; // 编码ISO-8859-1
mb_detect_encoding($str, 'UTF-8', true); // 判断结果false
</code>
Copy after login

汉字编码后还是汉字么?

mb_detect_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