Initial understanding of ASCII

Source: Internet
Author: User
Tags ftp protocol

ASCII: The United States Standard Information Interchange code, is now the most common single-byte encoding system. Here is a simple understanding of what the code means. Coding is the process by which information transforms from one form or format to another. A conversion convention is required in this process. When all the data in the computer is stored and run, all the information is represented by the binary number (0,1), and what binary data represents which symbols, everyone can contract their own set, if others want to read their own data, you need to know their coding rules. ASCII encoding is a standardized coding specification, which specifies which binary symbols are used to represent the common notation. is equivalent to the relationship between Putonghua and dialect. The same meaning can be expressed in multiple languages, such as Chinese and English. The process of coding is a process of translation, such as Chinese translation into English, but translation also needs to have translation rules, such as the word ' new ' in English is ' a '. and ASCII code, that is, in the form of numbers to represent the text.

Say again the single byte. Simply understood, the single byte is the Latin character, the double byte is the Chinese, the Japanese, the Korean hieroglyphics.

Here's an example of how the ASCII code translates the text into a language that the computer can understand.

(1) ASCII code ' A '--its memory storage byte 2 is represented as "01000001"---its 16 binary value is 0x41---its 10 binary value is 65 (here the value is actually ' A ' in the ASCII Code table number);

Verification process:
char c = ' A ';
printf ("%c\n", c);/* A */
printf ("%x\n", c);/* 41 */
printf ("%d\n", c);/* 65 */

(2) ASCII code ' 6 '--its memory storage byte 2 binary is represented as "00110110"---its 16 binary value is 0x36---its 10 binary value is 54 (here the value is actually ' 6 ' in the ASCII Code table number);

Verification process:
char c = ' 6 ';
printf ("%c\n", c);/* 6 */
printf ("%x\n", c);/* 36 */
printf ("%d\n", c);/* 54 */

ASCII code Communication
What kind of communication is the use of ASCII code as a means of communication? (There are two modes of communication in the FTP protocol, one of which is the ASCII code, that is, the text mode) here also illustrate: for example, we want to transfer the value 123, 123 value is represented by the 16 binary as 0x7b, the binary is represented as 01111011, then the binary mode of communication, 01111011 is the actual data we transmit, but if we communicate in ASCII mode, it is completely different, it should be the number of 123 per digit into its corresponding ASCII code, and then transfer. The ASCII codes for the ' 1 ', ' 2 ', and ' 3 ' correspond to 0x31, 0x32, and 0x33, respectively, in 16 binary notation. The data to be transmitted after this combination should be "001100010011001000110011".

A string is stored sequentially in memory in the ASCII code-by-character basis, and we generally do not need to do special conversions when transferring strings.

Initial understanding of ASCII

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.