如果 ASCII 每个字符使用 12 位怎么办?

what if ASCII uses 12 bits per character?

如果ASCII用7位来表示字符。有人可以解释这对支持的字符数意味着什么。如果 ASCII 每个字符使用 12 位,那会有什么变化?

一个位有两种可能的状态。一组 n 位有 2n 个可能的状态。

因此7位可以表示27 = 128个可能的字符,12位可以表示212 = 4096个可能的字符。

这段来自 Wikipedia's table of character sets 的节选提供了历史视角:

   BCDIC         1928                     6 bits  Introduced with      
                                                  the IBM card         

   FIELDATA      1956                     6/7     Battlefield          
                                          bits    information (USA)    

   EBCDIC        1963                     8 bits  IBM computers        
                                                  Teleprinters and     
                                                  computers;           

   ASCII         1963-06-17               7 bits  original             
                 (ASA X3.4-1963)                  definition of        
                                                  ASCII                

   ECMA-6        1965-04-30               7 bits  ASCII localization   

   ISO 646       1967 (ISO/R646-1967)     7 bits  ASCII localization   

                 1967 (USAS                       Close to "modern"    
   ASCII         X3.4-1967)               7 bits  definition of        
                                                  ASCII                
                                                  IBM data             

   Braille ASCII 1969                     6/7     Tactile print for    
                                          bits    blind persons        

                                                  Terminal text        
   ECMA-48       1972                     7 bits  manipulation and     
                                                  colors               

   ISO/IEC 8859  1987                     8 bits  International        
                                                  codes                

                                                  Unified encoding     
   Unicode       1991                     16/32   for most of the      
                                          bits    world's writing      
                                                  systems              

12 位代码可以支持 2 到 12 或 4096 个字符,对于 non-characters 减去一两个字符,例如 null,可能是转义符,以及一些空白字符。

现在你可以用12位字节构造一台计算机了。但这将是一项昂贵的 re-engineering 操作。大多数计算机有 8 位字节,至少部分是因为 ascii。

但是选择扩展 ascii 的方法是 Unicode,而作为标准出现的编码是 UTF-8。这在某种意义上是 ascii 的超集 - ascii 是 unicode。设置未使用的最高位并添加额外的字节以生成扩展的 non-Latin 字符。所以它是可变宽度编码,代码始终是 8 位的倍数,它的末端略微开放,可以在范围的顶部添加代码,但目前编码的宽度永远不会超过 4 个字节。