Today, I heard someone complaining that he received a file that contained “unexpected characters”. Later it was discovered that this file was provided in EBCDIC and the receiver tried to open it on a UNIX box with an ordinary editor. Such a UNIX box assumes the ASCII lay-out and as the file was delivered in EBCDIC, the characters shown were not comprehensible.
What is the difference between ASCII and EBCDIC?
Roughly stated ASCII and EBCDIC both translate a byte into a character. A byte may have 256 different values. A byte then ranges from 0 to 255. In heximal format: it ranges from 00 to FF. This implies that a byte with heximal value 20 is ASCII interpreted as a blank. It also implies that a byte with heximal value 40 is EBCDIC interpreted as a blank.
We can see the heximal values when we toggle in a text-editor between the normal representation and the heximal representation. On my laptop, I have a text editor (Notepad++) that allows such a toggle. My laptop uses the ASCII representation and toggling shows that “TOM ” is equivalent to heximal values “54 4F 4D 20”. On Windows and Unix the ASCII representation is most often used and text editors on either a Windows box or a UNIX provide you with the heximal representation.
On the other hand, EBCDIC is used on IBM mainframes. There, we also have the possibility to show the heximal values. See:.
All right. Assume, we get a file that contain strange characters. Do we have a EBCDIC/ASCII mix up?
If we are working on a Windows or Unix box, we see the ASCII representation. We know that the ASCII heximal value of “@” is 40. This 40 is translated into a space under EBCDIC. Hence: if we see in an editor on a Windows/Unix box many “@”, we may suspect that an EBCDIC file is delivered whereby the blanks are translated into ASCII “@”.
Another possibility is to look at the heximal representation. If we see many “F0”, we may suspect an EBCDIC file as the EBCDIC heximal value F0 stands for a “0”. Hence: many heximal values of F0 indicate EBCDIC as any file may contains many 0.
Hence: enough clues to find out if an EBCDIC file is delivered in stead of an ASCII file!