^M characters are embedded at the end of every record.

Julian T J Midgley jtjm@xenoclast.org
Wed Nov 6 22:49:01 2002

On Wed, 6 Nov 2002, Loo, Peter wrote:

> Hi All,
> I created a text file in Windows environment.  Then it is encrypted and
> FTPed to a Unix server where the file is decrypted.  After decryption, I
> am seeing ^M characters at the end of each record.  I have tried sending
> the file in both ASCII and BINARY modes.  Both modes don't help.
> However, if I send the plain text file via FTP in ASCII mode, the file
> does not contain and control characters.  Is there a way to decrypt the
> file into an output file without ^M character or is there a way to
> encrypt the file without ^M?

This is nothing to do with GPG; Windows (and DOS systems generally) use
CRLF to mark end of line, whereas Unix system uses LF only.  The ^M
characters you see on the Unix machine are the 'spare' CR characters that
Windows introduces.

FTP's ascii mode deals with the translation from one format to the other
automatically, but clearly can't do this for an encrypted file.  The
easiest thing to do is to strip the spurious carriage-returns on the Unix
machine post-decryption. ( tr -d '\r' < file > cleanfile )

qv: http://galaxy.ps.uci.edu/users/esirko/howto/crlf.html


Julian T. J. Midgley                       http://www.xenoclast.org/
Cambridge, England.
PGP: BCC7863F FP: 52D9 1750 5721 7E58 C9E1  A7D5 3027 2F2E BCC7 863F