且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASCII 与 Unicode + UTF-8

更新时间:2023-11-27 12:58:34

是的,除了 UTF-8 是一种编码方案.其他编码方案包括 UTF-16(具有两种不同的字节顺序)和 UTF-32.(对于一些混淆,UTF-16 方案在 Microsoft 软件中称为Unicode".)

Yes, except that UTF-8 is an encoding scheme. Other encoding schemes include UTF-16 (with two different byte orders) and UTF-32. (For some confusion, a UTF-16 scheme is called "Unicode" in Microsoft software.)

而且,确切地说,定义 ASCII 的美国国家标准将字符集合及其编码指定为 7 位数量,但没有指定以字节为单位的特定传输编码.过去,它以不同的方式使用,例如这样五个 ASCII 字符被打包到一个 36 位存储单元中,或者 8 位字节将额外的字节用于检查目的(奇偶校验位)或传输控制.但是现在使用 ASCII,因此一个 ASCII 字符被编码为一个 8 位字节,第一位设置为零.这是事实上的标准编码方案,并隐含在大量规范中,但严格来说不是 ASCII 标准的一部分.

And, to be exact, the American National Standard that defines ASCII specifies a collection of characters and their coding as 7-bit quantities, without specifying a particular transfer encoding in terms of bytes. In the past, it was used in different ways, e.g. so that five ASCII characters were packed into one 36-bit storage unit or so that 8-bit bytes used the extra bytes for checking purposes (parity bit) or for transfer control. But nowadays ASCII is used so that one ASCII character is encoded as one 8-bit byte with the first bit set to zero. This is the de facto standard encoding scheme and implied in a large number of specifications, but strictly speaking not part of the ASCII standard.