Traditional Culture Encyclopedia - The 24 Solar Terms - How many bytes does a Chinese character take up?
How many bytes does a Chinese character take up?
Utf8 characters are variable-length characters, so here is a supplement to the encoding method of uft-8.
One byte: 0 * * * * *
Two bytes:110 * * *,10 * * *
Three bytes:11/kloc-0 * * *,10 * * *,10 * * *
Four bytes:1110,10 * * * *,10 * * * *.
Five bytes:1110,10 * * * *,10 * * * *.
Six bytes:11110, 10 * * *,10 * *.
So after getting the byte string, if you want to judge the byte length of UTF8 character, you only need to get the first byte of the character according to the above rules, and you can judge that the character is represented by several bytes according to its value.
GBK coding, a Chinese character takes up two bytes. UTF- 16 encoding, usually Chinese characters account for two bytes, and Chinese characters in CJKV extension B, extension C and extension D account for four bytes (the Unicode range of general characters is from U+0000 to U+FFFF, and these extensions are larger than U+20000, so two UTF- 16 are needed). UTF-8 encoding is variable length encoding. Usually, Chinese characters account for three bytes, and the Chinese characters after expanding B area account for four bytes.
- Previous article:What effect does the seasonal change have on the growth of animals and plants?
- Next article:What is the constellation on April 20th?
- Related articles
- What are the quality problems of Volkswagen EA2 1 1 engine?
- How to judge whether there is carbon deposit in the engine
- The solar terms of pony
- What does beginning of spring mean early? The meaning of beginning of spring in the 24 solar terms.
- Is September autumn or summer?
- What changes have taken place in Tomb-Sweeping Day's flora and fauna?
- How to Adjust the Valve of Motorcycle
- A small gift for my girlfriend.
- Writing in winter all year round.
- What is the material of finidi q50l fuel tank?