Prev: parsing csv
Next: Simple hack to get $600 to your home.
From: Harry on 16 Jun 2010 14:59 How could I convert ASCII to EBCDIC, and vice versa? I tried iconv under cygwin, with no avail. $ iconv -f ascii -t CP819 input.txt ... iconv: input.txt:1:2: cannot convert $ iconv -f CP819 -t ASCII input.txt ... iconv: input.txt:1:2: cannot convert $ cat input.txt ...I_%.IAEEÑ?>..........E?/oA>I.á>IA%?oA.I_%>E.E?/oA>I..ÇEEo...EÄÇA_/ E.I_ %E?/o.?EÅ.E?/o.A>IA%?oA..I_%>E.IEA..ÇEEo...III.I..? EÅ......ì(<ëÄÇA_/..I_ %>E.IEÑ..ÇEEo...III.I..?EÅ......ì(<ëÄÇA_/.Ñ>EE/>ÄA.....E?/oA>I.çA/ AAE... |oçAE..|oçAEîAEE+I_......|oçAEîAEE+I_..|oàAAä>E....|oàAAä>E..| oàAAçAE.EA É......ëIÄAîAEE+I_......ëIÄAîAEE+I_..&/`%?/ Aè`oA...ëIÄAñA.ëäà(..ëIÄAñA.. |oñA.ä%ÑA>EëÄEAA>êAEo..|oñA...|oàAAçAE...|oçAE..ñë(çAE..ñë(çAEîAEE +I_... ....ñë(çAEîAEE+I_..á_o%`íEAEñA...ä%>EñA...å%?A%<?ÅñA....(EÅñ>EEÄñA.... (EÅñ >EEÄñA..ñ>A>AäÇ/>%ñA.......ñ>A>AäÇ/>%ñA.. oo+/_A.á.¬ëäà(.. oo+/_A..ä%>Eç ?EEñA.ñ..ä%>Eç?EEñA..ñ>A>AäÇ/>%ñA.(..ñ>A>AäÇ/>%ñA...(EÅäEA/ Eè_Eo......... ...è.......................(EÅäEA/Eè_Eo...ñë(çAE...E?/oA>I.çA/AAE...E?/ oA >I.â?A`...êÉEE&/`%?/A...|oàAAêÉEE.EAÉ.......(AEE/ÅA...ñA................. ................................ëäà(.......ñA...êAEI%E..EAEI%EE.....EAEI %E ..EAÄ?EA+I_AAE.........AI>ÄEÑ?>.>/_A..ï<(.&ê|äáëë..?EAAE...........EAEI %Eñ EA_.E`oA..EAEI%E........ÑA....ÑA.......oE?oAEE`........,A`.Ä? AA..,A`.... .....I/%IA.+|çñè..I/%IA........oE?oAEE`.......EAEI%EñEA_......AI>ÄEÑ? >... ...EAEI%E....EAEI%EE...êAEI%E....(AEE/ÅA....|oàAAêÉEE....êÉEE&/`%?/ A....E ?/oA>I.â?A`....E?/oA>I.á>IA%?oA.. TIA
From: Janis Papanagnou on 16 Jun 2010 15:58 Harry wrote: > How could I convert ASCII to EBCDIC, and vice versa? man dd Janis > > I tried iconv under cygwin, with no avail. > > $ iconv -f ascii -t CP819 input.txt > .. > iconv: input.txt:1:2: cannot convert > > $ iconv -f CP819 -t ASCII input.txt > .. > iconv: input.txt:1:2: cannot convert > $ cat input.txt [snip junk] > > TIA
From: Lew Pitcher on 16 Jun 2010 16:13 On June 16, 2010 14:59, in comp.unix.shell, harryooopotter(a)hotmail.com wrote: > How could I convert ASCII to EBCDIC, and vice versa? > > I tried iconv under cygwin, with no avail. > > $ iconv -f ascii -t CP819 input.txt > .. > iconv: input.txt:1:2: cannot convert > > $ iconv -f CP819 -t ASCII input.txt > iconv: input.txt:1:2: cannot convert CP819 isn't an EBCDIC variant. If you've got EBCDIC data in input.txt, I'm guessing (because I don't have an iconv manual to check against) that iconv is rightly complaining that it can't convert the text, as it is neither ASCII (as you tell it in your first example) or CP819 (as you tell it in the second example). > $ cat input.txt > ..I_%.IAEEÃ?>..........E?/oA>I.á>IA%?oA.I_%>E.E?/oA>I..ÃEEo...EÃÃA_/ > E.I_ [snip useless output] Ok, so you've proved that input.txt contains neither ASCII nor CP819 text. A more helpful output would have been 'od -x' or 'hexdump -x'. That would at least let us see the hex representation, and be able to match the file up to it's proper EBCDIC variant. FWIW, you probably want EBCDIC-INT (CP038) or EBCDIC-US Take a look at the EBCDIC-* variants catalogued at http://anubis.dkuug.dk/i18n/charmaps/ if you really think you have an EBCDIC (variant) file. These might help you determine /which/ EBCDIC the file is coded in. Also, Janis' suggestion of using dd(1) is good. However, dd(1) seems to only recognize two EBCDIC variants, and doesn't specify /which/ variants they are. My guess is EBCDIC-INT and EBCDIC-US, so if you find that your input.txt contains some offbeat EBCDIC (like EBCDIC-JP-KANA, for instance), you are likely going to be out of luck with dd(1). > TIA HTH -- Lew Pitcher Master Codewright & JOAT-in-training | Registered Linux User #112576 Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/ ---------- Slackware - Because I know what I'm doing. ------
From: Harry on 16 Jun 2010 17:38 On Jun 16, 12:58 pm, Janis Papanagnou <janis_papanag...(a)hotmail.com> wrote: > Harry wrote: > > How could I convert ASCII to EBCDIC, and vice versa? > > man dd > > Janis How nice! Thanks
From: Harry on 16 Jun 2010 18:39
On Jun 16, 1:13 pm, Lew Pitcher <lpitc...(a)teksavvy.com> wrote: [...] > Also, Janis' suggestion of using dd(1) is good. However, dd(1) seems to only > recognize two EBCDIC variants, and doesn't specify /which/ variants they > are. My guess is EBCDIC-INT and EBCDIC-US, so if you find that your > input.txt contains some offbeat EBCDIC (like EBCDIC-JP-KANA, for instance), > you are likely going to be out of luck with dd(1). > Lew Pitcher This is what the first line look in in hex. $ head -1 input.txt | od -x 0000000 2e2e 5fcc 2e25 c1ce cbca 3fd1 2e3e 2e2e 0000020 2e2e 2e2e 2e2e cb2e 2f3f c1f8 ce3e e12e 0000040 ce3e 25c1 f83f 2ec1 5fcc 3e25 2ecb 3fcb 0000060 f82f 3ec1 2ece c72e c8c8 2ef8 2e2e c4cb 0000100 c1c7 2f5f 2ecb 5fcc 0a0d 0000112 And iconv can understand neirther ebdic nor cp038 ... $ iconv -l | grep -i ebcdic $ iconv -l | grep -i cp038 $ So I could not use dd and iconv. Anyone has any other suggestions ? |