About Java encoding

Source: Internet
Author: User

ASCII: Use 7-bit encoding to store English characters and some common symbols as values from 0 to 127. Unicode: Unicode uses a 2-byte number to represent each character, from 0 to 65535. Each 2-byte number represents a unique character that is used in at least one of the world languages. (characters that are used in multiple languages have the same numeric code.) This ensures that each character is a number, and each digit is one character. Unicode data will never be ambiguous. Unicode uses the same numbers to denote characters in ASCII and iso-8859-1. Only these two encodings are represented by one byte, while Unicode is represented by two bytes. So Unicode represents both encoded characters as long as the low byte is available, and the high byte is 0. UTF-8: UTF-8 is a variable-length encoding that can be encoded from 1 to 6 bytes per UTF-8. It encodes Unicode-encoded characters in a variable-length manner. Encodings belonging to Iso-8859-1 in Unicode take the same single-byte encoding as iso-8859-1. Other characters are encoded with more than two bytes. In fact, for a two-byte Unicode encoding, UTF-8 is represented as long as three bytes. The first byte starts with n 1 (1< n <= 6), and N represents the number of bytes encoded, followed by 10 for each byte, and 6 bits for the second. Connecting the remaining bits of the first bit to the last six bits of all subsequent bytes is the corresponding Unicode encoded value. GB2312 and GBK:Both of these codes are the encoding standard for Chinese characters, the former being a subset of the latter. GBK encoded text documents have the same single-byte representation for characters in ASCII, with double-byte encoding for Chinese characters and punctuation in Chinese, where high bytes are greater than 0x80, and all ASCII characters are less than 0x80, so ASCII and GBK characters can be mixed together. The GBK character set and Unicode conversions are irregular and require a conversion table to be converted.
Related Article

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.