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
- So, in the spirit of conservation, UTF-8 encoding that converts Unicode encoding into "variable length encoding" appeared.
- UTF-8 encoding encodes a Unicode character into 1-6 bytes according to different number sizes. Commonly used English letters are encoded into 1 byte. Chinese characters are usually 3 bytes, and only a few Uncommon characters will be encoded into 4-6 bytes. If the text you want to transmit contains a lot of English characters, using UTF-8 encoding can save space.
Characters | ASCII | Unicode | UTF-8 |
---|---|---|---|
A | 01000001 | 00000000 01000001 | 01000001 |
中文 | x | 01001110 00101101 | 01001110 00101101 |
- ## From the above table, we can also find that UTF-8 encoding has an additional The advantage is that ASCII encoding can actually be regarded as part of UTF-8 encoding. Therefore, a large number of historical legacy software that only supports ASCII encoding can continue to work under UTF-8 encoding.
5. How common character encoding works in computers
- In the computer memory, Unicode encoding is used uniformly, and when it needs to be saved to the hard disk Or when it needs to be transmitted, convert it to UTF-8 encoding.
- When editing with Notepad, the UTF-8 characters read from the file are converted into Unicode characters and stored in the memory. After the editing is completed, Unicode is converted into UTF-8 when saving. To the file:
- When browsing the web, the server will convert the dynamically generated Unicode content into UTF-8 and then transmit it. To the browser:
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

ASCII (American Standard Code for Information Interchange, American Standard Code for Information Interchange) is a set of character encodings based on Latin letters. It contains a total of 128 characters and can be stored in one byte. It is equivalent to the international standard ISO/IEC 646 . The ASCII specification was first published in 1967 and last updated in 1986.

The ASCII code value of d is 100; because the ASCII code value of a is the hexadecimal number 61H, that is, the decimal value is 97, and d is the last three digits of a, then the ASCII code value of d is "97+3=100" ;ASCII code uses a specified 7-bit or 8-bit binary number combination to represent 128 or 256 possible characters.

One ascii character occupies 1 byte. ASCII code characters are represented by 7-bit or 8-bit binary encoding in the computer and are stored in one byte, that is, one ASCII code occupies one byte. ASCII code can be divided into standard ASCII code and extended ASCII code. Standard ASCII code is also called basic ASCII code. It uses 7-bit binary numbers (the remaining 1 binary digit is 0) to represent all uppercase and lowercase letters, and the numbers 0 to 9. Punctuation marks, and special control characters used in American English.

An ASCII code occupies one byte. ASCII code is a coding standard used to represent characters. It uses 7-bit binary numbers to represent 128 different characters, including letters, numbers, punctuation marks, special characters, etc. A byte is the basic unit of computer storage unit. It consists of 8 binary bits. Each binary bit can be 0 or 1. One byte can represent 256 different values, so it can represent all characters in the ASCII code.

ascii code is a computer coding system based on Latin letters; ascii code is the abbreviation of "American Standard Code for Information Interchange". It is mainly used to display modern English and other Western European languages. It is the most common information exchange standard, using the designated 7 bit or 8-bit binary number combination to represent 128 or 256 possible characters.

ASCII value conversion in PHP is a problem often encountered in programming. ASCII (American Standard Code for Information Interchange) is a standard encoding system for converting characters into numbers. In PHP, we often need to convert between characters and numbers through ASCII code. This article will introduce how to convert ASCII values in PHP and give specific code examples. 1. Change the characters

Unicode is a character encoding standard used to represent various languages and symbols. To convert Unicode encoding to Chinese characters, you can use Python's built-in functions chr() and ord().

In-depth understanding of PHP: Implementation method of converting JSONUnicode to Chinese During development, we often encounter situations where we need to process JSON data, and Unicode encoding in JSON will cause us some problems in some scenarios, especially when Unicode needs to be converted When encoding is converted to Chinese characters. In PHP, there are some methods that can help us achieve this conversion process. A common method will be introduced below and specific code examples will be provided. First, let us first understand the Un in JSON