Bit/byte/character/character set/encoding

Live well and let the flow take its course. The so-called life is half surprise and half regret. Cherish all the unexpected encounters, and leave without saying goodbye to all those who are indifferent.

1、bit

A bit, also called a bit, is the smallest unit of data that a computer represents.

2. Byte:

8 binary bits constitute a "byte (Byte)", which is the basic measurement unit of storage space, recognized by the computer.

3. Characters:

Refers to the words and symbols used in the computer, such as 1, 2, 3, A, B, C, ~! ·#¥%……—*()——+, etc., recognized by humans.

In different encodings, the correspondence between characters and bytes is different:

① In the ASCII code, an English letter (not case sensitive) occupies one byte of space, and a Chinese character occupies two bytes of space. A sequence of binary numbers, as a digital unit in a computer, is generally an 8-bit binary number, converted to decimal. The minimum value is 0 and the maximum value is 255.
② In UTF-8 encoding, one English character is equal to one byte, and one Chinese (including traditional) is equal to three bytes.

③In Unicode encoding, one English is equal to two bytes, and one Chinese (including traditional) is equal to two bytes.

④In UTF-16 encoding, 2 bytes are required to store an English alphabet character or a Chinese character character (some Chinese characters in the Unicode extension area need 4 bytes to store).

⑤In UTF-32 encoding, the storage of any character in the world requires 4 bytes.

4. Character set:

(Standard ASCii character set/gbk character set/Unicode character set)
is a collection of various characters, that is to say which Chinese characters, letters (A, b, c) and symbols (spaces, quotation marks...) will be included in the standard.

5. Coding:

According to the rules, the characters are translated into corresponding binary numbers, run and stored in the calculator, when the user looks at it (such as a browser), then use the corresponding code to parse it out that the user can understand;

Guess you like

Origin blog.csdn.net/qq_37304462/article/details/114437361