How PHP determines the number of bytes that a word occupies
Source: Internet
Author: User
How PHP determines the number of bytes that a word occupies.
Win7 inside seems to have added some new words. The number of bytes is 4 bits.
How to determine the existence of this Chinese character in a string. Like what:
[Email protected]
@ Represents a Chinese character with byte digits 4. When I pick up the characters, [email protected]
Ask Master enlighten how to judge the existence of the first word, with JS can also
------Solution--------------------
The double-byte portion of the GB 18030 is fully GBK with the internal code system. On this basis, a four-byte extension is made, and the four-byte encoding space is sequentially: 0x81 to 0xfe,0x30 to 0x39,0x81 to 0xfe,0x30 to 0x39. A total of 1,587,600 code bits
That means you can't just judge a byte, and if the value of the second byte is in the range of 0x30 to 0x39, he's a 4-byte character.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.