Mail formatting

der Mouse mouse at Rodents.Montreal.QC.CA
Sat Dec 29 13:12:59 CST 2007

> One of the recurring issues of ASCII is:
> "What is the ASCII code for newline?"

0x0a, one of whose names is NL.  This is well-defined.

> Is a new line CR (carriage return)?  LF (linefeed)?   CR LF?   LF CR?

This is not a question about ASCII; it is a question about how some
unspecified system represents linebreaks - about how that system uses
ASCII, perhaps.

Worse, on many systems the answer differs depending what point you
measure at.  On most Unix variants, for example, it's 0x0a when
measured in files or in C strings, but 0x0d 0x0a when measured on
hardware serial lines.

> Is '\n' 0Dh?  0Ah?  0Dh 0Ah?  0Ah 0Dh?

It's only one character; that much is well-specified (well, assuming
your '\n' was supposed to be C).  What the numerical value of that
character is is not well-defined without reference to a particular
system (though 0x0a is by far the commonest, probably because it's

> Before you answer, contemplate:
> "Why have SO MANY companies got that wrong?"
> ("wrong" actually means any choice other than yours, and each company
> thought that there were good reasons for doing it their way.)

Then in what sense are those choices "wrong"?

> Fergeddabout how Henk's message quotes look on the screen.  In the
> raw message, BEFORE processing by the mail program, do those parts of
> his messages have 0Dh characters?  Do they have 0Ah characters?

"the mail program"?  There were at, let's check headers..6
pieces of software that could reasonably be called "mail program"s
involved in getting the message from Hank to any list receiver's
system, possibly excepting the small (maybe empty) set of people who
actually read list mail on  There's at least one
additional piece of software involved (displaying the message) and
possibly more.

By definition, in the SMTP transaction, the line breaks are 0x0d 0x0a
octet pairs (and 0x0d and 0x0a octets do not occur in any other context
than 0x0d-0x0a line-break pairs..unless, of course, the sending SMTP
code is broken).

Of course, there is a lot of broken SMTP code out there.  Looking at
headers makes me think Hank's mail was actually sent through Hotmail,
which means it's almost certain the sending SMTP code was broken
(though not necessarily in this way).

However, as it arrived at my system, it apepars to have been fine in
this regard, so I see no reason to think line-break botches elsewhere
than between the list and Ethan are behind this.  I'm mystified as to
what provoked the behaviour Ethan saw, since he says it's just Hank's
mail, and as far as I can tell Hank's mail is fine after passing
through the list.

Ethan, did Hank send you an off-list copy, and you replied to that one,
maybe?  It's the most plausible theory I see offhand.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

More information about the cctalk mailing list