EBCDIC

EBCDIC（Extended Binary Coded Decimal Interchange Code，扩增二进式十进交换码），为IBM于1963年－1964年间推出的字元编码表，根据早期打孔机式的BCDIC即一种二进化十进数（BCD，Binary Coded Decimal）信息交换编码改进而成。是IBM迷尔级以上电脑的标准码。

它的缺点是：英文字母不是连续地排列，中间出现多次断续，为撰写程式的人带来了一些困难。

## 字符对应

EBCDIC编码表，最初定义了（不计空白字符在内的）88个可打印字符，同时还定义了减去26个小写字母后的62个可打印字符的子集：

0x｜U+0000 NULL｜U+0001 START OF HEADING｜U+0002 START OF TEXT｜U+0003 END OF TEXT｜U+0009 CHARACTER TABULATION｜U+007F DELETE｜U+000B LINE TABULATION｜U+000C FORM FEED (FF)｜U+000D CARRIAGE RETURN (CR)｜U+000E SHIFT OUT｜U+000F SHIFT IN

1x｜U+0010 DATA LINK ESCAPE｜U+0011 DEVICE CONTROL ONE｜U+0012 DEVICE CONTROL TWO｜U+0013 DEVICE CONTROL THREE｜U+0085 NEXT LINE (NEL)｜U+0008 BACKSPACE｜U+0018 CANCEL｜U+0019 END OF MEDIUM｜U+001C INFORMATION SEPARATOR FOUR｜U+001D INFORMATION SEPARATOR THREE｜U+001E INFORMATION SEPARATOR TWO｜U+001F INFORMATION SEPARATOR ONE

2x｜U+000A LINE FEED (LF)｜U+0017 END OF TRANSMISSION BLOCK｜U+001B ESCAPE｜U+0005 ENQUIRY｜U+0006 ACKNOWLEDGE｜U+0007 BELL

3x｜U+0016 SYNCHRONOUS IDLE｜U+0004 END OF TRANSMISSION｜U+0014 DEVICE CONTROL FOUR｜U+0015 NEGATIVE ACKNOWLEDGE｜U+001A SUBSTITUTE

4x｜U+0020 SPACE｜U+00A2 CENT SIGN｜U+002E FULL STOP｜U+003C LESS-THAN SIGN｜U+0028 LEFT PARENTHESIS｜U+002B PLUS SIGN｜U+007C VERTICAL LINE

5x｜U+0026 AMPERSAND｜U+0021 EXCLAMATION MARK｜U+0024 DOLLAR SIGN｜U+002A ASTERISK｜U+0029 RIGHT PARENTHESIS｜U+003B SEMICOLON｜U+00AC NOT SIGN

6x｜U+002D HYPHEN-MINUS｜U+002F SOLIDUS｜U+00A6 BROKEN BAR｜U+002C COMMA｜U+0025 PERCENT SIGN｜U+005F LOW LINE｜U+003E GREATER-THAN SIGN｜U+003F QUESTION MARK

7x｜U+0060 GRAVE ACCENT｜U+003A COLON｜U+0023 NUMBER SIGN｜U+0040 COMMERCIAL AT｜U+0027 APOSTROPHE｜U+003D EQUALS SIGN｜U+0022 QUOTATION MARK

8x｜U+0061 LATIN SMALL LETTER A｜U+0062 LATIN SMALL LETTER B｜U+0063 LATIN SMALL LETTER C｜U+0064 LATIN SMALL LETTER D｜U+0065 LATIN SMALL LETTER E｜U+0066 LATIN SMALL LETTER F｜U+0067 LATIN SMALL LETTER G｜U+0068 LATIN SMALL LETTER H｜U+0069 LATIN SMALL LETTER I

9x｜U+006A LATIN SMALL LETTER J｜U+006B LATIN SMALL LETTER K｜U+006C LATIN SMALL LETTER L｜U+006D LATIN SMALL LETTER M｜U+006E LATIN SMALL LETTER N｜U+006F LATIN SMALL LETTER O｜U+0070 LATIN SMALL LETTER P｜U+0071 LATIN SMALL LETTER Q｜U+0072 LATIN SMALL LETTER R

Ax｜U+007E TILDE｜U+0073 LATIN SMALL LETTER S｜U+0074 LATIN SMALL LETTER T｜U+0075 LATIN SMALL LETTER U｜U+0076 LATIN SMALL LETTER V｜U+0077 LATIN SMALL LETTER W｜U+0078 LATIN SMALL LETTER X｜U+0079 LATIN SMALL LETTER Y｜U+007A LATIN SMALL LETTER Z

Bx｜U+005E CIRCUMFLEX ACCENT｜U+005B LEFT SQUARE BRACKET｜U+005D RIGHT SQUARE BRACKET

Cx｜U+007B LEFT CURLY BRACKET｜U+0041 LATIN CAPITAL LETTER A｜U+0042 LATIN CAPITAL LETTER B｜U+0043 LATIN CAPITAL LETTER C｜U+0044 LATIN CAPITAL LETTER D｜U+0045 LATIN CAPITAL LETTER E｜U+0046 LATIN CAPITAL LETTER F｜U+0047 LATIN CAPITAL LETTER G｜U+0048 LATIN CAPITAL LETTER H｜U+0049 LATIN CAPITAL LETTER I

Dx｜U+007D RIGHT CURLY BRACKET｜U+004A LATIN CAPITAL LETTER J｜U+004B LATIN CAPITAL LETTER K｜U+004C LATIN CAPITAL LETTER L｜U+004D LATIN CAPITAL LETTER M｜U+004E LATIN CAPITAL LETTER N｜U+004F LATIN CAPITAL LETTER O｜U+0050 LATIN CAPITAL LETTER P｜U+0051 LATIN CAPITAL LETTER Q｜U+0052 LATIN CAPITAL LETTER R

Ex｜U+005C REVERSE SOLIDUS｜U+0053 LATIN CAPITAL LETTER S｜U+0054 LATIN CAPITAL LETTER T｜U+0055 LATIN CAPITAL LETTER U｜U+0056 LATIN CAPITAL LETTER V｜U+0057 LATIN CAPITAL LETTER W｜U+0058 LATIN CAPITAL LETTER X｜U+0059 LATIN CAPITAL LETTER Y｜U+005A LATIN CAPITAL LETTER Z

Fx｜U+0030 DIGIT ZERO｜U+0031 DIGIT ONE｜U+0032 DIGIT TWO｜U+0033 DIGIT THREE｜U+0034 DIGIT FOUR｜U+0035 DIGIT FIVE｜U+0036 DIGIT SIX｜U+0037 DIGIT SEVEN｜U+0038 DIGIT EIGHT｜U+0039 DIGIT NINE

在打孔卡上顺序列出的1964年EBCDIC的62个字符

```
    _______________________________________________________________
   / &-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/:#@'="¢.<(+|!$*);¬,%_>?
12|  ▊           ▊▊▊▊▊▊▊▊▊                        ▊▊▊▊▊▊
11|   ▊                   ▊▊▊▊▊▊▊▊▊                     ▊▊▊▊▊▊
 0|    ▊                           ▊▊▊▊▊▊▊▊▊                  ▊▊▊▊▊
 1|     ▊        ▊        ▊                ▊
 2|      ▊        ▊        ▊       ▊        ▊     ▊     ▊
 3|       ▊        ▊        ▊       ▊        ▊     ▊     ▊    ▊
 4|        ▊        ▊        ▊       ▊        ▊     ▊     ▊    ▊
 5|         ▊        ▊        ▊       ▊        ▊     ▊     ▊    ▊
 6|          ▊        ▊        ▊       ▊        ▊     ▊     ▊    ▊
 7|           ▊        ▊        ▊       ▊        ▊     ▊     ▊    ▊
 8|            ▊        ▊        ▊       ▊  ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊
 9|             ▊        ▊        ▊       ▊
  |________________________________________________________________
```

```
    _______________________________________________________________
   / 123456789:#@'="&ABCDEFGHI¢.<(+|-JKLMNOPQR!$*);¬0/STUVWXYZ,%_>?
12|                 ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊
11|                                 ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊
 0|                                                 ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊
 1|  ▊               ▊               ▊               ▊
 2|   ▊       ▊       ▊       ▊       ▊       ▊       ▊
 3|    ▊       ▊       ▊       ▊       ▊       ▊       ▊      ▊
 4|     ▊       ▊       ▊       ▊       ▊       ▊       ▊      ▊
 5|      ▊       ▊       ▊       ▊       ▊       ▊       ▊      ▊
 6|       ▊       ▊       ▊       ▊       ▊       ▊       ▊      ▊
 7|        ▊       ▊       ▊       ▊       ▊       ▊       ▊      ▊
 8|         ▊ ▊▊▊▊▊▊        ▊ ▊▊▊▊▊▊        ▊ ▊▊▊▊▊▊        ▊ ▊▊▊▊▊
 9|          ▊               ▊               ▊               ▊
  |________________________________________________________________
```

在处理ASCII可打印字符之时，将其`[`占位`¢`，其`]`占位`!`，其`!`占位（表示逻辑或的）`|`，而其`^`占位（表示逻辑非的）`¬`，并补充上所缺少的属于ASCII的6个标点符号，成为（不计空白字符在内的）94个可打印字符的编码表：

0x｜U+0000 NULL｜U+0001 START OF HEADING｜U+0002 START OF TEXT｜U+0003 END OF TEXT｜U+0009 CHARACTER TABULATION｜U+007F DELETE｜U+000B LINE TABULATION｜U+000C FORM FEED (FF)｜U+000D CARRIAGE RETURN (CR)｜U+000E SHIFT OUT｜U+000F SHIFT IN

1x｜U+0010 DATA LINK ESCAPE｜U+0011 DEVICE CONTROL ONE｜U+0012 DEVICE CONTROL TWO｜U+0013 DEVICE CONTROL THREE｜U+0085 NEXT LINE (NEL)｜U+0008 BACKSPACE｜U+0018 CANCEL｜U+0019 END OF MEDIUM｜U+001C INFORMATION SEPARATOR FOUR｜U+001D INFORMATION SEPARATOR THREE｜U+001E INFORMATION SEPARATOR TWO｜U+001F INFORMATION SEPARATOR ONE

2x｜U+000A LINE FEED (LF)｜U+0017 END OF TRANSMISSION BLOCK｜U+001B ESCAPE｜U+0005 ENQUIRY｜U+0006 ACKNOWLEDGE｜U+0007 BELL

3x｜U+0016 SYNCHRONOUS IDLE｜U+0004 END OF TRANSMISSION｜U+0014 DEVICE CONTROL FOUR｜U+0015 NEGATIVE ACKNOWLEDGE｜U+001A SUBSTITUTE

4x｜U+0020 SPACE｜U+005B LEFT SQUARE BRACKET｜U+002E FULL STOP｜U+003C LESS-THAN SIGN｜U+0028 LEFT PARENTHESIS｜U+002B PLUS SIGN｜U+0021 EXCLAMATION MARK

5x｜U+0026 AMPERSAND｜U+005D RIGHT SQUARE BRACKET｜U+0024 DOLLAR SIGN｜U+002A ASTERISK｜U+0029 RIGHT PARENTHESIS｜U+003B SEMICOLON｜U+005E CIRCUMFLEX ACCENT

6x｜U+002D HYPHEN-MINUS｜U+002F SOLIDUS｜U+00A6 BROKEN BAR｜U+002C COMMA｜U+0025 PERCENT SIGN｜U+005F LOW LINE｜U+003E GREATER-THAN SIGN｜U+003F QUESTION MARK

7x｜U+0060 GRAVE ACCENT｜U+003A COLON｜U+0023 NUMBER SIGN｜U+0040 COMMERCIAL AT｜U+0027 APOSTROPHE｜U+003D EQUALS SIGN｜U+0022 QUOTATION MARK

8x｜U+0061 LATIN SMALL LETTER A｜U+0062 LATIN SMALL LETTER B｜U+0063 LATIN SMALL LETTER C｜U+0064 LATIN SMALL LETTER D｜U+0065 LATIN SMALL LETTER E｜U+0066 LATIN SMALL LETTER F｜U+0067 LATIN SMALL LETTER G｜U+0068 LATIN SMALL LETTER H｜U+0069 LATIN SMALL LETTER I

9x｜U+006A LATIN SMALL LETTER J｜U+006B LATIN SMALL LETTER K｜U+006C LATIN SMALL LETTER L｜U+006D LATIN SMALL LETTER M｜U+006E LATIN SMALL LETTER N｜U+006F LATIN SMALL LETTER O｜U+0070 LATIN SMALL LETTER P｜U+0071 LATIN SMALL LETTER Q｜U+0072 LATIN SMALL LETTER R

Ax｜U+007E TILDE｜U+0073 LATIN SMALL LETTER S｜U+0074 LATIN SMALL LETTER T｜U+0075 LATIN SMALL LETTER U｜U+0076 LATIN SMALL LETTER V｜U+0077 LATIN SMALL LETTER W｜U+0078 LATIN SMALL LETTER X｜U+0079 LATIN SMALL LETTER Y｜U+007A LATIN SMALL LETTER Z

Bx｜U+005E CIRCUMFLEX ACCENT｜U+005B LEFT SQUARE BRACKET｜U+005D RIGHT SQUARE BRACKET

Cx｜U+0041 LATIN CAPITAL LETTER A｜U+0042 LATIN CAPITAL LETTER B｜U+0043 LATIN CAPITAL LETTER C｜U+0044 LATIN CAPITAL LETTER D｜U+0045 LATIN CAPITAL LETTER E｜U+0046 LATIN CAPITAL LETTER F｜U+0047 LATIN CAPITAL LETTER G｜U+0048 LATIN CAPITAL LETTER H｜U+0049 LATIN CAPITAL LETTER I

Dx｜U+004A LATIN CAPITAL LETTER J｜U+004B LATIN CAPITAL LETTER K｜U+004C LATIN CAPITAL LETTER L｜U+004D LATIN CAPITAL LETTER M｜U+004E LATIN CAPITAL LETTER N｜U+004F LATIN CAPITAL LETTER O｜U+0050 LATIN CAPITAL LETTER P｜U+0051 LATIN CAPITAL LETTER Q｜U+0052 LATIN CAPITAL LETTER R

Ex｜U+005C REVERSE SOLIDUS｜U+0053 LATIN CAPITAL LETTER S｜U+0054 LATIN CAPITAL LETTER T｜U+0055 LATIN CAPITAL LETTER U｜U+0056 LATIN CAPITAL LETTER V｜U+0057 LATIN CAPITAL LETTER W｜U+0058 LATIN CAPITAL LETTER X｜U+0059 LATIN CAPITAL LETTER Y｜U+005A LATIN CAPITAL LETTER Z

Fx｜U+0030 DIGIT ZERO｜U+0031 DIGIT ONE｜U+0032 DIGIT TWO｜U+0033 DIGIT THREE｜U+0034 DIGIT FOUR｜U+0035 DIGIT FIVE｜U+0036 DIGIT SIX｜U+0037 DIGIT SEVEN｜U+0038 DIGIT EIGHT｜U+0039 DIGIT NINE

在后来代码页版本的EBCDIC中，定义了“不变子集”58个字符，即在62个可打印字符子集基础上再去掉4个被占用了字符，并且计空白字符而不计`$`在内，如下图灰色底所示。然后于各版本的编码表中，加入了其他字符，以符合各地使用者所需。

以下是其中两个版本的EBCDIC编码表：CP037（英语）及CP500（多语言#5）。CP037为ASCII的`[`、`]`和`^`重新指定了位置不再占用EBCDIC的`¢`、`!`和`¬`，将其`!`认同为原来EBCDIC的`!`。CP500为被占用的EBCDIC的`¢`、`|`和`¬`重新指定了位置，将EBCDIC的`!`认同为占用了其位置的`!`。

EBCDIC CP037

x0｜x1｜x2｜x3｜x4｜x5｜x6｜x7｜x8｜x9｜xA｜xB｜xC｜xD｜xE｜xF

0x｜NUL｜SOH｜STX｜ETX｜ST｜HT｜SSA｜DEL｜EPA｜RI｜SS2｜VT｜FF｜CR｜SO｜SI

1x｜DLE｜DC1｜DC2｜DC3｜OSC｜NEL｜BS｜ESA｜CAN｜EM｜PU2｜SS3｜FS｜GS｜RS｜US

2x｜PAD｜HOP｜BPH｜NBH｜IND｜LF｜ETB｜ESC｜HTS｜HTJ｜VTS｜PLD｜PLU｜ENQ｜ACK｜BEL

3x｜DCS｜PU1｜SYN｜STS｜CCH｜MW｜SPA｜EOT｜SOS｜SGCI｜SCI｜CSI｜DC4｜NAK｜PM｜SUB

4x｜SP｜NBSP｜â｜ä｜à｜á｜ã｜å｜ç｜ñ｜¢｜.｜<｜(｜+｜|

5x｜&｜é｜ê｜ë｜è｜í｜î｜ï｜ì｜ß｜$｜、｜)｜;｜¬

6x｜/｜Â｜Ä｜À｜Á｜Ã｜Å｜Ç｜Ñ｜¦｜,｜%｜_｜>｜?

7x｜ø｜É｜Ê｜Ë｜È｜Í｜Î｜Ï｜Ì｜`｜:｜#｜@｜'｜=｜"

8x｜Ø｜a｜b｜c｜d｜e｜f｜g｜h｜i｜«｜»｜ð｜ý｜þ｜±

9x｜°｜j｜k｜l｜m｜n｜o｜p｜q｜r｜ª｜º｜æ｜¸｜Æ｜¤

Ax｜µ｜~｜s｜t｜u｜v｜w｜x｜y｜z｜¡｜¿｜Ð｜Ý｜Þ｜®

Bx｜^｜£｜¥｜·｜©｜§｜¶｜¼｜½｜¾｜¯｜¨｜´｜×

Cx｜`{`｜A｜B｜C｜D｜E｜F｜G｜H｜I｜SHY｜ô｜ö｜ò｜ó｜õ

Dx｜`}`｜J｜K｜L｜M｜N｜O｜P｜Q｜R｜¹｜û｜ü｜ù｜ú｜ÿ

Ex｜\｜÷｜S｜T｜U｜V｜W｜X｜Y｜Z｜²｜Ô｜Ö｜Ò｜Ó｜Õ

Fx｜0｜1｜2｜3｜4｜5｜6｜7｜8｜9｜³｜Û｜Ü｜Ù｜Ú｜APC

EBCDIC CP500

x0｜x1｜x2｜x3｜x4｜x5｜x6｜x7｜x8｜x9｜xA｜xB｜xC｜xD｜xE｜xF

0x｜NUL｜SOH｜STX｜ETX｜ST｜HT｜SSA｜DEL｜EPA｜RI｜SS2｜VT｜FF｜CR｜SO｜SI

1x｜DLE｜DC1｜DC2｜DC3｜OSC｜NEL｜BS｜ESA｜CAN｜EM｜PU2｜SS3｜FS｜GS｜RS｜US

2x｜PAD｜HOP｜BPH｜NBH｜IND｜LF｜ETB｜ESC｜HTS｜HTJ｜VTS｜PLD｜PLU｜ENQ｜ACK｜BEL

3x｜DCS｜PU1｜SYN｜STS｜CCH｜MW｜SPA｜EOT｜SOS｜SGCI｜SCI｜CSI｜DC4｜NAK｜PM｜SUB

4x｜SP｜NBSP｜â｜ä｜à｜á｜ã｜å｜ç｜ñ｜.｜<｜(｜+

5x｜&｜é｜ê｜ë｜è｜í｜î｜ï｜ì｜ß｜$｜、｜)｜;｜^

6x｜/｜Â｜Ä｜À｜Á｜Ã｜Å｜Ç｜Ñ｜¦｜,｜%｜_｜>｜?

7x｜ø｜É｜Ê｜Ë｜È｜Í｜Î｜Ï｜Ì｜`｜:｜#｜@｜'｜=｜"

8x｜Ø｜a｜b｜c｜d｜e｜f｜g｜h｜i｜«｜»｜ð｜ý｜þ｜±

9x｜°｜j｜k｜l｜m｜n｜o｜p｜q｜r｜ª｜º｜æ｜¸｜Æ｜¤

Ax｜µ｜~｜s｜t｜u｜v｜w｜x｜y｜z｜¡｜¿｜Ð｜Ý｜Þ｜®

Cx｜`{`｜A｜B｜C｜D｜E｜F｜G｜H｜I｜SHY｜ô｜ö｜ò｜ó｜õ

Dx｜`}`｜J｜K｜L｜M｜N｜O｜P｜Q｜R｜¹｜û｜ü｜ù｜ú｜ÿ

Ex｜\｜÷｜S｜T｜U｜V｜W｜X｜Y｜Z｜²｜Ô｜Ö｜Ò｜Ó｜Õ

Fx｜0｜1｜2｜3｜4｜5｜6｜7｜8｜9｜³｜Û｜Ü｜Ù｜Ú｜APC

于编码表中，0x00 - 0x3F及0xFF为控制字元，0x40为空格，0x41为不换行空格（no-break space），0xCA为选择性连字号（soft hyphen）。

## 外部链接

- F.0 Appendix F. Code Pages from AS/400 International Application Development V4R2
- ICU Character Mapping Tables 包含EBCDIC与Unicode的对应表
- LegacyJ- EBCDIC Table
- Computer Character Set Table
- Unicode Technical Report #16: UTF-EBCDICI