Home >Common Problem >What are the differences between unicode and ascii
The differences between unicode and ascii include different encoding ranges, different storage spaces, and different compatibility. Detailed introduction: 1. The encoding range is different. The encoding range of ASCII is 0-127, which is mainly used to represent English letters. The encoding range of Unicode is much wider and can represent almost all language characters; 2. The storage space is different. ASCII usually Use 1 byte to store a character, while unicode may use 2 or more bytes to store a character; 3. Different compatibility, etc.
The operating system for this tutorial: Windows 10 system, DELL G3 computer.
1. What is Unicode
Unicode is a character encoding standard. Its goal is to set a small number of codes for every character in the world. It can accommodate characters of almost all languages including English letters, Chinese characters, Japanese characters, Korean characters, Arabic numerals, etc.
2. What is ASCII
ASCII (American Standard Code for Information Interchange, American Standard Code for Information Interchange) is a character encoding based on English characters. It uses 7 bits to represent a character, and can represent a total of 128 different characters, including uppercase and lowercase English letters, Arabic numerals, punctuation marks, and some control characters.
3. The difference between Unicode and ASCII
The difference between unicode and ascii is mainly reflected in: 1. Different encoding ranges; 2. Storage space Different; 3. Different compatibility. In general, Unicode contains more characters than ASCII and can represent more languages.
1. Different coding ranges
The coding range of ASCII is 0-127, which is mainly used to represent English letters; while the coding range of Unicode is much wider and can represent almost all language characters.
2. Different storage spaces
ASCII encoding usually uses 1 byte to store a character, while Unicode encoding may use 2 or more bytes to store a character.
3. Different compatibility
ASCII encoding is part of Unicode encoding, that is to say, all ASCII characters have corresponding encodings in Unicode encoding. This also means that ASCII-encoded text can be converted directly to Unicode encoding without losing any information.
4. UTF8
Characters | ASCII | Unicode | UTF-8 |
---|---|---|---|
A | 01000001 | 00000000 01000001 | 01000001 |
中文 | x | 01001110 00101101 | 01001110 00101101 |
5. How common character encoding works in computers
The above is the detailed content of What are the differences between unicode and ascii. For more information, please follow other related articles on the PHP Chinese website!