Mailbox, tell and read

Gordon McMillan Gordon.McMillan at p98.f112.n480.z2.fidonet.org
Thu Jul 1 04:01:02 EDT 1999


From: "Gordon McMillan" <gmcm at hypernet.com>

Paul Prescod wrote:

> Gordon McMillan wrote:
> > 
> > How 'bout opening in binary, and munging line endings yourself just
> > before returning the message? 
> 
> First, are there platforms other than DOS/Windows/Win32 where there
> is a difference between text and binary mode?

There's a theoretical difference on *nix - otherwise, they wouldn't 
have made up the distinction!

> I didn't want to munge
> things myself because I'm not sure if what is the "right" munge on
> the Mac, for instance. Can I just do a search and replace for CR/LF
> -> CR on all platforms, all of the time?

On Windows, Notepad (and the underlying default text widget) require
\r\n, but newer widgets / editors will be happy with \n. On *nix,
most tools will show a \r as a noise character. No idea how
forgiving Mac tools are.

AFAIK, we have
 *nix -> \n
 Windows -> \r\n
 Mac -> \r
 
However, since you're dealing with messages created who-knows-where 
and run through who-knows-what transformations, you may well have to 
munge no matter what.


- Gordon





More information about the Python-list mailing list