{"id":310,"date":"2012-10-02T21:10:45","date_gmt":"2012-10-02T21:10:45","guid":{"rendered":"http:\/\/62.131.51.129\/wordpress\/?p=310"},"modified":"2012-10-02T21:10:45","modified_gmt":"2012-10-02T21:10:45","slug":"ascii-or-ebcdic-how-to-recognise-it","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=310","title":{"rendered":"ASCII or EBCDIC: how to recognise it?"},"content":{"rendered":"<p>Today, I heard someone complaining that he received a file that contained &#8220;unexpected characters&#8221;. 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.<\/p>\n<p>What is the difference between ASCII and EBCDIC? <\/p>\n<p>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.<br \/>\nWe 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 &#8220;TOM &#8221; is equivalent to heximal values &#8220;54 4F 4D 20&#8221;. 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.<br \/>\nOn the other hand, EBCDIC is used on IBM mainframes. There, we also have the possibility to show the heximal values. See:<a href=\"http:\/\/62.131.51.129\/wp-content\/uploads\/2012\/10\/EBCDIC.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/62.131.51.129\/wp-content\/uploads\/2012\/10\/EBCDIC.jpg\" alt=\"\" title=\"EBCDIC\" width=\"150\" height=\"60\" class=\"alignnone size-full wp-image-311\" \/><\/a>.<\/p>\n<p>All right. Assume, we get a file that contain strange characters. Do we have a EBCDIC\/ASCII mix up?<br \/>\nIf we are working on a Windows or Unix box, we see the ASCII representation. We know that the ASCII heximal value of &#8220;@&#8221; is 40. This 40 is translated into a space under EBCDIC. Hence: if we see in an editor on a Windows\/Unix box many &#8220;@&#8221;, we may suspect that an EBCDIC file is delivered whereby the blanks are translated into ASCII &#8220;@&#8221;.<br \/>\nAnother possibility is to look at the heximal representation. If we see many &#8220;F0&#8221;, we may suspect an EBCDIC file as the EBCDIC heximal value F0 stands for a &#8220;0&#8221;. Hence: many heximal values of F0 indicate EBCDIC as any file may contains many 0.<br \/>\nHence: enough clues to find out if an EBCDIC file is delivered in stead of an ASCII file!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, I heard someone complaining that he received a file that contained &#8220;unexpected characters&#8221;. 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-310","post","type-post","status-publish","format-standard","hentry","category-nice-to-know"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}