[Haskell-cafe] code in postings mangled?

Joachim Durchholz jo at durchholz.org
Fri Nov 19 13:54:04 UTC 2021


Am 18.11.21 um 17:49 schrieb Olaf Klinke:
>> Why is code in postings so often mangled:
>>
> 
> Seems it is only the linebreaks. Some programs on Windows, including
> TextEdit and likely your mail client, don't consider a newline '\n'
> character to be a line break, since Windows terminates lines by "\r\n".

This used to be very true 20 years ago, and too-often-true 10 years ago, 
but today even crummy old Notepad does recognize \n as a linebreak.
Any IDE or even mildly feature-rich editor should be able to deal with 
them. Most even have an easy-to-reach area in the status line that tells 
you what the line break convention in your text is, and many even make 
so that clicking on that field allows you to change it.

This problem essentially died a decade ago, though obviously there's 
always the possibility of bugs.

> Then OS X has '\r' line terminators, which again might not be
> considered a linebreak on some systems.

Only really old versions of MacOS ("Mac OS Classic") use \r; the last 
version of that was 9.x, which was phased out end of 2001, twenty years ago.
Max OS X (Darwin and later) are based on BSD (with multiple intermediate 
steps), and uses the Unix-ish \n as line break.

Of course, old mail clients might still insist on \r on Mac, but I doubt 
that anything newer is still using it.

> I remember all kinds of stupid things arising from this, including
> version control systems flagging every line as changed when it was only
> the line breaks.
> I read this list as digest, so I can not verify using the particular
> raw email you quoted. Can someone else check this?

Outlook is known to apply all kinds of heuristics to try and infer line 
breaks. Heuristics are known to be less than optimal and sometimes 
outright stupid; newer versions of Outlook have a small message like "we 
removed extraneous line breaks, click here to restore them", and that 
tends to unmangle lines.

Regards,
Jo


More information about the Haskell-Cafe mailing list