Francesco Pietra wrote:

I'm leaving you CC'd on this, something I don't usually do, as I want to be sure you get this. Apologies if you are subscribed and get mail twice.

A script downloaded to a desktop i386/etch/gnome from Amber web site, edited on
the desktop with gnome text editor, then sent scp to a computing machine amd64,
turned out to be polluted by DOS formatting.

The computing program was prevented from reading the polluted lines.

I tried

dos2unix scriptfilename

This is the correct command for the desired conversion, but ... see below.


which failed to clean the script. Opening the script with vim did not reveal
the problem. It was only

VIM, if configured to do so (see 'set fileformat' and 'set fileformats' in VIM help), will do auto conversion from/to DOS and so will hide the file type being edited. The only indication is when the file is first read in, in the status line:

  "filename" [dos] linesL, charsC

So you may have missed it, assuming it was printed.


od -c scriptfilename > od.dmp

that revealed non printing characters, octal 302 followed by octal 240 at each
script line.

Here's the issue: in ASCII, the DOS format <CR><NL> in octal would be 015 followed by 012, not the numbers you provide.

The dos2unix/unix2dos and vim programs are looking for the ASCII value and so would not touch the 302 240 pair you found. So the file would be unchanged.


I was unfamiliar with such affairs and wonder about the origin of the
pollution. The desktop has wine installed (for a Windows-based database that
finds no efficient substitute in unix) and may be (don't remember) the database
had been launched before editing of the said script.

1) Is wine likely to have caused the pollution?

Perhaps, but more likely it was downloaded that way, I think.


2) Is the above dos2unix command correctly issued?

Yes.


Thanks

francesco pietra



What information does 'file scriptfilename' report? You may find you have some other character set encoding to have to convert from.

You may also find that a binary editor would let you search for and globally replace the offending character pairs with an ASCII newline (octal 012).

--
Bob McGowan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to