Introduction
EBCDIC is IBM’s family of 8-bit encodings, from the System/360 (1963 to 1964), and
still the native text of z/OS and IBM i. It is not based on ASCII: the space is
40, the digits are F0 to F9, and the letters
come in three runs. “Hi” is C8 89. There are hundreds of EBCDIC code
pages. No file says which one it uses, so the explorer recognises EBCDIC from its
bytes, guesses a code page, and shows the file in every page it knows.
Files are normally converted to ASCII when they leave the mainframe, so EBCDIC
.txt files are rare on PCs, and no browser decodes EBCDIC. A file dropped
on any page of this site opens in the explorer, which decodes it.
Structure
The file is characters and line endings, with no header. Records of fixed length with no line endings are common on mainframes, and such a file shows as one long line here, because nothing in it marks a record’s length.
0Lines characters of one byte, each line followed by its line endingvaries
Byte order mark
EBCDIC has no byte order mark, and nothing in the file names the code page.
Encoding
Each byte is one character. Letters are in three runs (A–I, J–R, S–Z), with a gap
between each, and lower case at 81 to A9. Code page 037 is
the usual choice for US English; 500 for international; 1047 for z/OS Unix.
Code page 037
Table of every byte. The names in 00 to 3F and
FF are EBCDIC’s own control codes, listed below the table, with SP the
space, NBSP the no-break space, SHY the soft hyphen and RSV a byte IBM reserved.
Every code page on this page uses the same control codes. The tables that map
EBCDIC to Unicode give each of them a C0 or C1 code point (04 is
U+009C, 06 U+0086, FF U+009F) so that text converts and
back; the ISO 6429 names of those code points (ST, SSA, APC) are not the bytes’
names, and the explorer does not use them.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0_ | NUL | SOH | STX | ETX | SEL | HT | RNL | DEL | GE | SPS | RPT | VT | FF | CR | SO | SI |
| 1_ | DLE | DC1 | DC2 | DC3 | RES | NL | BS | POC | CAN | EM | UBS | CU1 | IFS | IGS | IRS | IUS |
| 2_ | DS | SOS | FS | WUS | BYP | LF | ETB | ESC | SA | SFE | SM | CU2 | MFA | ENQ | ACK | BEL |
| 3_ | RSV | RSV | SYN | IR | PP | TRN | NBS | EOT | SBS | IT | RFF | CU3 | DC4 | NAK | RSV | SUB |
| 4_ | SP | NBSP | â | ä | à | á | ã | å | ç | ñ | ¢ | . | < | ( | + | | |
| 5_ | & | é | ê | ë | è | í | î | ï | ì | ß | ! | $ | * | ) | ; | ¬ |
| 6_ | - | / | Â | Ä | À | Á | Ã | Å | Ç | Ñ | ¦ | , | % | _ | > | ? |
| 7_ | ø | É | Ê | Ë | È | Í | Î | Ï | Ì | ` | : | # | @ | ' | = | " |
| 8_ | Ø | a | b | c | d | e | f | g | h | i | « | » | ð | ý | þ | ± |
| 9_ | ° | j | k | l | m | n | o | p | q | r | ª | º | æ | ¸ | Æ | ¤ |
| A_ | µ | ~ | s | t | u | v | w | x | y | z | ¡ | ¿ | Ð | Ý | Þ | ® |
| B_ | ^ | £ | ¥ | · | © | § | ¶ | ¼ | ½ | ¾ | [ | ] | ¯ | ¨ | ´ | × |
| C_ | { | A | B | C | D | E | F | G | H | I | SHY | ô | ö | ò | ó | õ |
| D_ | } | J | K | L | M | N | O | P | Q | R | ¹ | û | ü | ù | ú | ÿ |
| E_ | \ | ÷ | S | T | U | V | W | X | Y | Z | ² | Ô | Ö | Ò | Ó | Õ |
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ³ | Û | Ü | Ù | Ú | EO |
Code page 500 (international)
Code page 037 with the seven differences below: the common punctuation moves.
| Byte | 500 | 037 |
|---|---|---|
4A | [ | ¢ |
4F | ! | | |
5A | ] | ! |
5F | ^ | ¬ |
B0 | ¢ | ^ |
BA | ¬ | [ |
BB | | | ] |
Code page 1047 (open systems Latin-1)
Code page 037 with six differences, so that the square brackets and circumflex are
where C programs on z/OS Unix expect them. Some z/OS conversions also swap NL
(15) and LF (25); the explorer treats both as line
endings.
| Byte | 1047 | 037 |
|---|---|---|
5F | ^ | ¬ |
AD | [ | Ý |
B0 | ¬ | ^ |
BA | Ý | [ |
BB | ¨ | ] |
BD | ] | ¨ |
National variants
These are code page 037 with national letters in place of some punctuation. Each row lists every byte that differs from 037, as byte and character.
| Code page | Differences from 037 |
|---|---|
| 273 (Germany, Austria) | 43 {, 4A Ä, 4F !, 59 ~, 5A Ü, 5F ^, 63 [, 6A ö, 7C §, A1 ß, B0 ¢, B5 @, BA ¬, BB |, C0 ä, CC ¦, D0 ü, DC }, E0 Ö, EC \, FC ] |
| 277 (Denmark, Norway) | 47 }, 4A #, 4F !, 5A ¤, 5B Å, 5F ^, 67 $, 6A ø, 70 ¦, 7B Æ, 7C Ø, 80 @, 9C {, 9E [, 9F ], A1 ü, B0 ¢, BA ¬, BB |, C0 æ, D0 å, DC ~ |
| 278 (Finland, Sweden) | 43 {, 47 }, 4A §, 4F !, 51 `, 5A ¤, 5B Å, 5F ^, 63 #, 67 $, 6A ö, 71 \, 79 é, 7B Ä, 7C Ö, 9F ], A1 ü, B0 ¢, B5 [, BA ¬, BB |, C0 ä, CC ¦, D0 å, DC ~, E0 É, EC @ |
| 280 (Italy) | 44 {, 48 \, 4A °, 4F !, 51 ], 54 }, 58 ~, 5A é, 5F ^, 6A ò, 79 ù, 7B £, 7C §, 90 [, A1 ì, B0 ¢, B1 #, B5 @, BA ¬, BB |, C0 à, CD ¦, D0 è, DD `, E0 ç |
| 284 (Spain, Latin America) | 49 ¦, 4A [, 5A ], 5B $, 69 #, 6A ñ, 7B Ñ, A1 ¨, B0 ¢, BA ^, BB !, BD ~ |
| 285 (United Kingdom) | 4A $, 4F |, 5A !, 5B £, 5F ¬, A1 ¯, B0 ¢, B1 [, BA ^, BC ~ |
| 297 (France) | 44 @, 48 \, 4A °, 4F !, 51 {, 54 }, 5A §, 5F ^, 6A ù, 79 µ, 7B £, 7C à, 90 [, A0 `, A1 ¨, B0 ¢, B1 #, B5 ], BA ¬, BB |, BD ~, C0 é, D0 è, DD ¦, E0 ç |
| 871 (Iceland) | 4A Þ, 4F !, 5A Æ, 5B $, 5F Ö, 79 ð, 7C Ð, 8C `, 8E {, 9C }, 9E ], A1 ö, AC @, AE [, B0 ¢, BA ¬, BB |, BE \, C0 þ, CC ~, D0 æ, E0 ´, EC ^ |
Code pages 278, 285 and 871 follow IBM’s own tables. Some other converters
(glibc, and the iconv of macOS) differ from them at 71 and
E0 in 278, at A1 and BC in 285 and at
4A and C0 in 871, and a file converted with one of
those reads differently there.
The euro pages, 1140 to 1149
Each of these is the earlier page of the same country with the euro sign U+20AC
in place of the currency sign ¤ (U+00A4), and no other change. The currency sign is
at 9F in all of them except 277 and 278, which have it at
5A; the table says where each euro is.
| Code page | Is | Euro at |
|---|---|---|
| 1140 | 037 (US, Canada, Australia) | 9F |
| 1141 | 273 (Germany, Austria) | 9F |
| 1142 | 277 (Denmark, Norway) | 5A |
| 1143 | 278 (Finland, Sweden) | 5A |
| 1144 | 280 (Italy) | 9F |
| 1145 | 284 (Spain, Latin America) | 9F |
| 1146 | 285 (United Kingdom) | 9F |
| 1147 | 297 (France) | 9F |
| 1148 | 500 (international) | 9F |
| 1149 | 871 (Iceland) | 9F |
Code page 420 (Arabic)
Table of bytes 40 to FF; 00 to 3F
are the control codes of code page 037. Arabic letters are shown as letters; the
contextual forms, which have a code point of their own in Unicode’s presentation
block, and the marks, are written as U+ followed by the code point. An empty cell
has no character.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4_ | SP | NBSP | U+0651 | U+FE7D | U+0640 | U+200B | ء | آ | U+FE82 | أ | ¢ | . | < | ( | + | | |
| 5_ | & | U+FE84 | ؤ | ئ | ا | U+FE8E | ب | U+FE91 | ! | $ | * | ) | ; | ¬ | ||
| 6_ | - | / | ة | ت | U+FE97 | ث | U+FE9B | ج | U+FE9F | ح | ¦ | , | % | _ | > | ? |
| 7_ | U+FEA3 | خ | U+FEA7 | د | ذ | ر | ز | س | U+FEB3 | U+060C | : | # | @ | ' | = | " |
| 8_ | ش | a | b | c | d | e | f | g | h | i | U+FEB7 | ص | U+FEBB | ض | U+FEBF | ط |
| 9_ | ظ | j | k | l | m | n | o | p | q | r | ع | U+FECA | U+FECB | U+FECC | غ | U+FECE |
| A_ | U+FECF | ÷ | s | t | u | v | w | x | y | z | U+FED0 | ف | U+FED3 | ق | U+FED7 | ك |
| B_ | U+FEDB | ل | U+FEF5 | U+FEF6 | U+FEF7 | U+FEF8 | U+FEFB | U+FEFC | U+FEDF | م | U+FEE3 | ن | U+FEE7 | ه | ||
| C_ | U+061B | A | B | C | D | E | F | G | H | I | SHY | U+FEEB | U+FEEC | و | ||
| D_ | U+061F | J | K | L | M | N | O | P | Q | R | ى | U+FEF0 | ي | U+FEF2 | U+FEF3 | U+0660 |
| E_ | × | S | T | U | V | W | X | Y | Z | U+0661 | U+0662 | U+0663 | U+0664 | U+0665 | ||
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | U+0666 | U+0667 | U+0668 | U+0669 | EO |
Code page 424 (Hebrew)
Table of bytes 40 to FF; 00 to 3F
are the control codes of code page 037. The Hebrew letters are at 41
to 49, 51 to 59, 62 to
69 and 71, so the Latin lower case is at 81 and
upper case at C1 as in 037.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4_ | SP | א | ב | ג | ד | ה | ו | ז | ח | ט | ¢ | . | < | ( | + | | |
| 5_ | & | י | ך | כ | ל | ם | מ | ן | נ | ס | ! | $ | * | ) | ; | ¬ |
| 6_ | - | / | ע | ף | פ | ץ | צ | ק | ר | ש | ¦ | , | % | _ | > | ? |
| 7_ | ת | NBSP | ‗ | ` | : | # | @ | ' | = | " | ||||||
| 8_ | a | b | c | d | e | f | g | h | i | « | » | ± | ||||
| 9_ | ° | j | k | l | m | n | o | p | q | r | ¸ | ¤ | ||||
| A_ | µ | ~ | s | t | u | v | w | x | y | z | ® | |||||
| B_ | ^ | £ | ¥ | • | © | § | ¶ | ¼ | ½ | ¾ | [ | ] | ‾ | ¨ | ´ | × |
| C_ | { | A | B | C | D | E | F | G | H | I | SHY | |||||
| D_ | } | J | K | L | M | N | O | P | Q | R | ¹ | |||||
| E_ | \ | ÷ | S | T | U | V | W | X | Y | Z | ² | |||||
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ³ | EO |
Code page 870 (Latin-2: Central and Eastern Europe)
Table of bytes 40 to FF; 00 to 3F
are the control codes of code page 037.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4_ | SP | NBSP | â | ä | ţ | á | ă | č | ç | ć | [ | . | < | ( | + | ! |
| 5_ | & | é | ę | ë | ů | í | î | ľ | ĺ | ß | ] | $ | * | ) | ; | ^ |
| 6_ | - | / | Â | Ä | ˝ | Á | Ă | Č | Ç | Ć | | | , | % | _ | > | ? |
| 7_ | ˇ | É | Ę | Ë | Ů | Í | Î | Ľ | Ĺ | ` | : | # | @ | ' | = | " |
| 8_ | ˘ | a | b | c | d | e | f | g | h | i | ś | ň | đ | ý | ř | ş |
| 9_ | ° | j | k | l | m | n | o | p | q | r | ł | ń | š | ¸ | ˛ | ¤ |
| A_ | ą | ~ | s | t | u | v | w | x | y | z | Ś | Ň | Đ | Ý | Ř | Ş |
| B_ | ˙ | Ą | ż | Ţ | Ż | § | ž | ź | Ž | Ź | Ł | Ń | Š | ¨ | ´ | × |
| C_ | { | A | B | C | D | E | F | G | H | I | SHY | ô | ö | ŕ | ó | ő |
| D_ | } | J | K | L | M | N | O | P | Q | R | Ě | ű | ü | ť | ú | ě |
| E_ | \ | ÷ | S | T | U | V | W | X | Y | Z | ď | Ô | Ö | Ŕ | Ó | Ő |
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Ď | Ű | Ü | Ť | Ú | EO |
Code page 875 (Greek)
Table of bytes 40 to FF; 00 to 3F
are the control codes of code page 037. Unicode also publishes this page as
CP875.TXT.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4_ | SP | Α | Β | Γ | Δ | Ε | Ζ | Η | Θ | Ι | [ | . | < | ( | + | ! |
| 5_ | & | Κ | Λ | Μ | Ν | Ξ | Ο | Π | Ρ | Σ | ] | $ | * | ) | ; | ^ |
| 6_ | - | / | Τ | Υ | Φ | Χ | Ψ | Ω | Ϊ | Ϋ | | | , | % | _ | > | ? |
| 7_ | ¨ | Ά | Έ | Ή | NBSP | Ί | Ό | Ύ | Ώ | ` | : | # | @ | ' | = | " |
| 8_ | ΅ | a | b | c | d | e | f | g | h | i | α | β | γ | δ | ε | ζ |
| 9_ | ° | j | k | l | m | n | o | p | q | r | η | θ | ι | κ | λ | μ |
| A_ | ´ | ~ | s | t | u | v | w | x | y | z | ν | ξ | ο | π | ρ | σ |
| B_ | £ | ά | έ | ή | ϊ | ί | ό | ύ | ϋ | ώ | ς | τ | υ | φ | χ | ψ |
| C_ | { | A | B | C | D | E | F | G | H | I | SHY | ω | ΐ | ΰ | ‘ | ― |
| D_ | } | J | K | L | M | N | O | P | Q | R | ± | ½ | U+0387 | ’ | ¦ | |
| E_ | \ | S | T | U | V | W | X | Y | Z | ² | § | « | ¬ | |||
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ³ | © | » | EO |
Code page 1025 (Cyrillic)
Table of bytes 40 to FF; 00 to 3F
are the control codes of code page 037.
| _0 | _1 | _2 | _3 | _4 | _5 | _6 | _7 | _8 | _9 | _A | _B | _C | _D | _E | _F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4_ | SP | NBSP | ђ | ѓ | ё | є | ѕ | і | ї | ј | [ | . | < | ( | + | ! |
| 5_ | & | љ | њ | ћ | ќ | ў | џ | Ъ | № | Ђ | ] | $ | * | ) | ; | ^ |
| 6_ | - | / | Ѓ | Ё | Є | Ѕ | І | Ї | Ј | Љ | | | , | % | _ | > | ? |
| 7_ | Њ | Ћ | Ќ | SHY | Ў | Џ | ю | а | б | ` | : | # | @ | ' | = | " |
| 8_ | ц | a | b | c | d | e | f | g | h | i | д | е | ф | г | х | и |
| 9_ | й | j | k | l | m | n | o | p | q | r | к | л | м | н | о | п |
| A_ | я | ~ | s | t | u | v | w | x | y | z | р | с | т | у | ж | в |
| B_ | ь | ы | з | ш | э | щ | ч | ъ | Ю | А | Б | Ц | Д | Е | Ф | Г |
| C_ | { | A | B | C | D | E | F | G | H | I | Х | И | Й | К | Л | М |
| D_ | } | J | K | L | M | N | O | P | Q | R | Н | О | П | Я | Р | С |
| E_ | \ | § | S | T | U | V | W | X | Y | Z | Т | У | Ж | В | Ь | Ы |
| F_ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | З | Ш | Э | Щ | Ч | EO |
The mixed pages with double-byte characters: 930, 933, 935, 937 and 939
These pages hold single-byte text and, between SO (0E)
and SI (0F), double-byte characters: two bytes each,
both from 41 to FE, or 40 40 for the
ideographic space U+3000. SO and SI must pair within a line; the explorer starts each
line in single-byte mode. The single-byte part of each page is
an EBCDIC code page of its own, read from the same file.
| Code page | Language | Single bytes | Double bytes |
|---|---|---|---|
| 930 | Japanese | half-width katakana at 41 to 9F, with the Latin lower case moved to other bytes, and Latin capitals | kanji, kana and symbols |
| 939 | Japanese | Latin, and half-width katakana in the gaps | kanji, kana and symbols, the same set as 930 |
| 933 | Korean | Latin | hangul and hanja |
| 935 | Simplified Chinese | Latin | hanzi and symbols |
| 937 | Traditional Chinese | Latin | hanzi and symbols |
The explorer maps every double-byte code with a line in ICU’s mapping file for the page; it shows a double-byte code with no line as an invalid sequence, and a lone lead byte at the end of a line as cut short. A file is taken as one of these pages when it holds SO … SI runs and at least nine in ten of their codes have a character in that page, and the single bytes outside the runs look like EBCDIC; among the five, the one that reads the most pairs wins, and ties go to the page whose single bytes are more often ASCII letters.
Where the tables come from
The tables of the pages that are not written out above, and the check of the ones
that are, come from IBM’s own conversion tables as the ICU project publishes them
(ibm-37_P100-1995.ucm and the rest of the 31 files for the pages on this
page), copied unchanged from the
ICU
mappings directory, commit 61607c27, to
explorer/formats/txt/data/ on this site, and parsed when the viewer needs
them. Each file carries IBM’s copyright line and the Unicode licence notice (Unicode
Terms of Use). Only the exact two-way mappings (the |0 lines) are used.
The hand tables of 037, 500, 1047, 273, 277, 278, 280, 284, 285 and 297, 871
match these files at every one of their 256 bytes. The tables of 420, 424, 870 and
875 were also compared with macOS’s iconv for bytes 40 to
FE: they agree except where iconv has no character (a few Romanian
and Czech letters of 870), its 870 differs from IBM’s at B0 and
B6 to BA, its 420 has the Arabic presentation forms
one place off and the digits as the Persian ones, and its 424 has a different
bullet and overline at B3 and BC. The explorer follows
IBM’s tables in all of them. Code page 1025 and the euro pages have no iconv
equivalent on macOS, so only the file is the source.
Control codes
Every EBCDIC code page has the same control codes at 00 to 3F
and FF. The names and abbreviations are those of the control code table
in Wikipedia’s article “EBCDIC” (a secondary source; IBM’s own list was not found
online), and the explorer shows each byte with them. The meanings are short
descriptions.
| Byte | Name | Meaning |
|---|---|---|
00 to 03 | NUL, SOH, STX, ETX | null; start of heading; start of text; end of text |
04 | SEL | select (PF, punch off, on card equipment) |
05 | HT | horizontal tab |
06 | RNL | required new line (LC, lower case, on older equipment) |
07 | DEL | delete |
08 | GE | graphic escape |
09, 0A | SPS, RPT | superscript; repeat |
0B to 0D | VT, FF, CR | vertical tab; form feed; carriage return |
0E, 0F | SO, SI | shift out and shift in: double-byte characters in pages 930 to 939 |
10 to 13 | DLE, DC1, DC2, DC3 | data link escape; device controls (13 is TM, tape mark, on tape equipment) |
14 | RES (ENP) | restore, enable presentation |
15 | NL | new line: the usual line end |
16 | BS | backspace |
17 | POC | program-operator communication |
18, 19 | CAN, EM | cancel; end of medium |
1A | UBS | unit backspace |
1B | CU1 | customer use 1 |
1C to 1F | IFS, IGS, IRS, IUS | interchange file, group, record and unit separators (1F is also ITB, intermediate transmission block) |
20, 21 | DS, SOS | digit select; start of significance |
22 | FS | field separator |
23 | WUS | word underscore |
24 | BYP (INP) | bypass, inhibit presentation |
25 | LF | line feed |
26, 27 | ETB, ESC | end of transmission block; escape |
28 to 2C | SA, SFE, SM (SW), CU2, MFA | set attribute; start field extended; set mode (switch); customer use 2; modify field attribute |
2D to 2F | ENQ, ACK, BEL | enquiry; acknowledge; bell |
30, 31, 3E | RSV | reserved by IBM, no function |
32 | SYN | synchronous idle |
33 to 36 | IR, PP, TRN, NBS | index return; presentation position; transparent; numeric backspace |
37 | EOT | end of transmission |
38, 39 | SBS, IT | subscript; indent tab |
3A, 3B | RFF, CU3 | required form feed; customer use 3 |
3C, 3D | DC4, NAK | device control 4; negative acknowledge |
3F | SUB | substitute |
FF | EO | eight ones |
Lines
Limits of the viewer. The Text tab, and each “read in this EBCDIC code page” row, shows the first 16 MB of the file (16,777,216 bytes), and says when it has stopped. A row of the Lines table shows the first 1,000 characters of its line, then “…”. Neither limit hides anything from the tree, which holds every line and, inside each line, every character, however long, and the counts cover the whole file.
Names. The character list names each EBCDIC control byte by its EBCDIC name (see the table of control codes below) and every other character by its Unicode name from the Unicode Character Database’s UnicodeData.txt, version 18.0.0, copied unchanged into the site (Unicode, Inc.’s data under the Unicode Terms of Use); a code point the file does not have is not assigned and gets no name.
A line is the bytes up to a line ending. Each character is one byte, so counts of characters and bytes are the same. Records of fixed length without line endings read as one long line.
Line endings
| Name | Bytes | Notes |
|---|---|---|
| NL (new line) | 15 | the usual line end on mainframes; U+0085 in code page 037 |
| LF (line feed) | 25 | U+000A in code page 037 |
| CR LF | 0D 25 | |
| CR | 0D |
End of the file
The text simply stops at the end of the file. EBCDIC text has no end-of-file mark of its own, but trailing NUL
bytes show as Zero padding, and a trailing 1A as an End-of-file mark, as in other text.
Problems
| Problem | Meaning |
|---|---|
| NUL character | a 00 byte in the text |
| control character | a byte that maps to a control other than tab, form feed and the line endings |
| mixed line endings | more than one kind of line ending |
| zero padding | NUL bytes after the text |
Telling it apart
There is no mark or signature. The explorer tries this format after UTF-8, UTF-16, UTF-32 and GB18030, and before the legacy code pages. It takes a file when, in the first 64 KB:
- the file is at least 16 bytes long;
- the space byte
40makes up at least one byte in twenty; - the bytes of the space, the EBCDIC letters and the digits together make up at least seven in ten;
- bytes in the ASCII letter ranges (
41–5A,61–7A) are at most one in five.
Code page 037 is assumed, unless the square brackets are at AD and
BD rather than BA and BB, which point to 1047.
National pages cannot be told apart from their bytes; the explorer shows the file in
each of them (037, 500, 1047, 273, 277, 278, 280, 284, 285, 297, 871, 420, 424, 870,
875, 1025, the euro pages 1140 to 1149, and the mixed pages 930, 933, 935, 937 and
939) so that a reader can pick.
A file with SO and SI around double-byte codes is taken as one of the mixed pages (see above), and the bytes between SO and SI do not count against the single-byte evidence.
Not described
The gaps are those on the text overview. For EBCDIC: code pages other than the 31 listed here are shown as the nearest page, or as legacy text, and the names of the control codes come from Wikipedia’s table because IBM’s own list was not found online.
Variants
- UTF-8 text – one to four bytes a character, ASCII unchanged
- UTF-16LE text – two or four bytes a character, low byte first
- UTF-16BE text – two or four bytes a character, high byte first
- UTF-32LE text – four bytes a character, low byte first
- UTF-32BE text – four bytes a character, high byte first
- Legacy code page text – a pre-Unicode code page that the file does not name
- UTF-7 text – Unicode as pure ASCII, with Base64 runs
- ISO-2022 and HZ text – 7-bit Japanese, Korean and Chinese with escape sequences
- GB18030 text – China’s national encoding, one, two or four bytes a character
- EBCDIC text – IBM mainframe text, not based on ASCII
- SCSU text – Unicode compressed with windows and tags
- BOCU-1 text – Unicode as differences between code points
- UTF-1 text – the withdrawn ISO 10646 transformation
- UTF-EBCDIC text – UTF-8 for EBCDIC systems
Links
Software
- iconv – command that converts EBCDIC files to UTF-8, with a code page chosen by name (macOS, Linux)
Reference
- Unicode’s mapping files – code page 037 and others byte by byte