What is the difference between a character and a byte

Source: Internet
Author: User
Tags alphabetic character

(i) Definition of "byte"

byte is a unit of measurement that represents the amount of data, a unit of measurement used by computer information technology to measure storage capacity.


(ii) Definition of "character"

characters are words and symbols used in the computer, such as 1, 2, 3, A, B, C, ~ #¥%......-* ()--+, and so on.


(iii) "byte" and "character"

They are completely not a concept of the plane, so there is no "difference" between the two. In different encodings, the correspondence between characters and bytes is different:

In ASCII code, an English letter (case-insensitive) occupies a byte of space, a Chinese character occupies two bytes of space. A binary number sequence, in the computer as a digital unit, generally 8-bit binary number, converted to decimal. The minimum value is 0, the maximum value is 255.

In UTF-8 encoding, an 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) equals two bytes.

Symbol: English punctuation is a byte, Chinese punctuation is two bytes. Example: English period "." The size of 1 bytes, the Chinese period. "Takes up 2 bytes of size.

In UTF-16 encoding, an alphabetic character or a Chinese character store requires 2 bytes (some Chinese characters stored in a Unicode expansion area need 4 bytes).

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

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.