php怎么判断一个字所占的字节数

WBOY
Release: 2016-06-13 10:57:44
Original
1497 people have browsed it

php如何判断一个字所占的字节数。
win7里面好像又新增加了一些字。字节数是4位的。

如何判断出一个字符串中存在这种汉字。比如:

[email protected]  

@代表字节数位4的汉字。 当我挨个取字符的时候,[email protected]

求高手赐教 如何判断初这个字的存在, 用JS也可以


------解决方案--------------------
GB 18030的双字节部分完全采用了GBK的内码系统。在此基础上,做了四字节扩展,四个字节的编码空间依次是:0x81到0xFE,0x30到0x39,0x81到0xFE,0x30到0x39。总共1,587,600个码位

就是说你不能仅仅判断一个字节,如果第二个字节的值是在0x30到0x39范围里时,他就是4字节的汉字了

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!