Re: Character set conversoin headaches



Text files in Unix System Services are supposed to have hex '15' as
newline characters. If you want to translate an ASCII file with CRLF
hex '0d0a' newlines to EBCDIC, you want the output file to have hex '15',
not '0d0a' or '0d15', so you should delete the '0d' before or after the
iconv. This command will delete ALL hex '0d' characters:

tr -d '\015' <infile >outfile

The \015 is octal notation, equivalent to hex '0d'.

I don't understand why you would want an EBCDIC file with CRLF as newline,
but if that's really what you want, you can translate the hex '0d15' back
to '0d0a' with this command:

tr '\025' '\012' <infile >outfile

which translates ALL hex '15' to hex '0a'.

Your description is confusing to me. You talk about converting to ASCII,
but then you use a command that converts to EBCDIC. Where and how does
converting to ASCII get involved here?

Bill Godfrey

On Mon, 26 Jun 2006 19:44:51 -0400, Taylor, Clarence B wrote:

I am attempting to transfer a binary file for my pc to a uss file and
then convert it to ascii. There is a little issue, in that the CRLF
sequences x'0d0a' are getting converted to '0d15'. When I ftp with
ascii they get translated to '0D0A'.

I do the translation in USS via the iconv utility, this causes the 0D15
sequence.

iconv -f ISO8859-1 -t IBM-1047 asm.sh > ../asm.sh

I have also tried IBM-037.

The short version as to why, is that I am creating an archive file on
the PC (actually a WAR file via ANT) and then doing the binary transfer,
so that the un-waring (JAR -XF file.ext) creates the identical build
directory structure under uss as I had on the PC. I then need to go
thru and convert specific files that are ascii, to ebcdic.

Depending upon the USS utility that is being used, it may or may not
recognize the '0D15' as being the same as '0D0A'. I could write a
custom utility to convert the '0D15' to 0D0A, but was kinda hoping there
was a standard utility to do this.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
.



Relevant Pages

  • Re: connected to access point but no internet found
    ... WEP has a problem converting from ASCII to Hexadecimal. ... algorithms for converting from ASCII to Hex. ... If you use the Hex key, ...
    (alt.internet.wireless)
  • RE: Character set conversoin headaches
    ... I made a mistake in my initial analysis in that an ascii file ... ASCII mode converted the two character sequence to a one character ... Text files in Unix System Services are supposed to have hex '15' as ... You talk about converting to ASCII, ...
    (bit.listserv.ibm-main)
  • Re: TCPDUMP Hexdump question
    ... On 2004-05-11, Webmaster wrote: ... >> I don't think you want to translate the hex to ASCII, ...
    (alt.os.linux)
  • Re: Sandisk WiFi+256 card using WPA-PSK
    ... > need to use a profile to connect using the Sandisk utility. ... > network key (in ascii) it complains that it's not a valid hex key. ...
    (microsoft.public.pocketpc)
  • Re: change from unicode to ASCII
    ... corner from which you can choose Unicode (hex), ASCII, or ASCII ... >> Microsoft MVP ...
    (microsoft.public.word.docmanagement)