Difference between Unicode and UTF-8, UTF-16

Unicode

Unicode is an international organization of ISO (International Standardization Organization). In order to solve the problem of inconsistent encoding in the world, a new code set that includes all cultures, all letters and symbols on the earth is re-engaged.

At first, Unicode stipulated that each character is represented by 2 bytes, but because English characters and so on only need one byte to represent, it will cause a waste of space when saving English text.

UTF-16、UTF-8

Unicode could not be promoted for a long time until the advent of the Internet. In order to solve the problem of how unicode is transmitted on the network, many UTF (UCS Transfer Format) standards for transmission appeared.
As the name suggests, UTF-8 is 8 bits at a time to transfer data, and UTF-16 is 16 bits at a time. UTF-8 is the most widely used unicode implementation on the Internet. This is an encoding designed for transmission, and makes the encoding without borders, so that it can display characters from all cultures in the world. The biggest feature of UTF-8 is that it is a variable-length encoding method. It can use 1 ~ 4 bytes to represent a symbol, and change the byte length according to different symbols. When the character is in the range of ASCII code, it is represented by one byte, and the one byte encoding of ASCII character is reserved as Part of it, note that unicode a Chinese character occupies 2 bytes, while UTF-8 a Chinese character occupies 3 bytes). From unicode to uft-8 is not a direct correspondence, but has to go through some algorithms and rules to convert.

Difference between Unicode and UTF-8, UTF-16

It can be seen that UTF-8 and UTF-16 are just different unicode transmission standards. Therefore, it can be understood as:
Unicode: is the character set
UTF-8, UTF-16 that contains all the characters in the world : is the Unicode character set, different encoding implementation.

Published 190 original articles · 19 praises · 200,000+ views

Guess you like

Origin blog.csdn.net/zengchenacmer/article/details/75332190