The relationship between unicode and utf8
Unicode is an encoding table, for example, specifying a code for a Chinese character. Similar to GB2312-1980, GB18030, etc., but with different character sets.
A unicode code may be converted into a UTF8 code with a length of one BYTE, or two, three, or four BYTE, depending on the value of the unicode code. Because the value of English unicode code is less than 0x80, it only needs to be transmitted in UTF8 of one BYTE, which is faster than sending two BYTEs of unicode.
UTF8 is just a "re-encoding" method devised to transmit unicode.
UTF8 to unicode can be reverse calculated using the program I gave above.
For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!
The above is the detailed content of The relationship between unicode and utf8. For more information, please follow other related articles on the PHP Chinese website!