一个字符有多少位或字节? [英] How many bits or bytes are there in a character?
问题描述
每个字符有多少位或字节?
How many bits or bytes are there per "character"?
推荐答案
这取决于字符是什么以及其编码是什么处于以下位置:
It depends what is the character and what encoding it is in:
-
8位ASCII编码的ASCII字符为8位(1字节),尽管可以容纳7位。
An ASCII character in 8-bit ASCII encoding is 8 bits (1 byte), though it can fit in 7 bits.
采用ISO-8859-1编码的ISO-8895-1字符为8位(1字节)。
An ISO-8895-1 character in ISO-8859-1 encoding is 8 bits (1 byte).
采用UTF-8编码的Unicode字符介于8位(1字节)和32位(4字节)之间。
A Unicode character in UTF-8 encoding is between 8 bits (1 byte) and 32 bits (4 bytes).
采用UTF-16编码的Unicode字符介于16(2个字节)和32位(4个字节)之间,尽管大多数常见字符占用16位。这是Windows内部使用的编码。
A Unicode character in UTF-16 encoding is between 16 (2 bytes) and 32 bits (4 bytes), though most of the common characters take 16 bits. This is the encoding used by Windows internally.
采用UTF-32编码的Unicode字符始终为32位(4字节)。
A Unicode character in UTF-32 encoding is always 32 bits (4 bytes).
UTF-8中的ASCII字符为8位(1字节),UTF-16中的ASCII字符为16位。
An ASCII character in UTF-8 is 8 bits (1 byte), and in UTF-16 - 16 bits.
ISO-8895-1(0xA0-0xFF)中的其他(非ASCII)字符在UTF-8和UTF-16中将占用16位。
The additional (non-ASCII) characters in ISO-8895-1 (0xA0-0xFF) would take 16 bits in UTF-8 and UTF-16.
这意味着一点之间会有0.03125到0.125个字符。
That would mean that there are between 0.03125 and 0.125 characters in a bit.
这篇关于一个字符有多少位或字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!