[Pdx-pm] UNIX NL verses MS(DOS) CRLF

Tom Phoenix rootbeer at redcat.com
Tue Aug 31 12:51:24 CDT 2004


On Tue, 31 Aug 2004, Roderick A. Anderson wrote:

> I'm using Marc Overmeer's Mailbox collection to process spam folders
> (mailboxen) and any time the process (re)writes the file I end up with
> NLs instead of CRLFs.  This causes all kinds of heart-ache and
> discontent with the users as they can't pop the messages back using
> Outlook.

It sounds like you're using code which wasn't written to be portable to
non-Unix machinery. If you're willing to fix it, you could perhaps hack it
to use $\ , which could be set at the time the file is opened. I haven't
looked at the code, though; it might be easier to search for uses of \n in
the code and replace each one with $LINE_ENDING or some such.

If you don't want to change the code, you could post-process the mailbox 
file to put the CRLFs back in. That's going to be slower, though, compared 
to fixing the module.

Speaking of portability, be sure to use binmode if you're going to handle 
lines ends directly, so that Perl won't garble your files.

Good luck with it!

--Tom Phoenix


More information about the Pdx-pm-list mailing list