Hacker News new | ask | show | jobs
by userbinator 3666 days ago
https://en.wikipedia.org/wiki/Newline#History

\r\n, CR+LF historically speaking was the first, but \n, LF became dominant because of Unix.

2 comments

If you break it down and view them as terminal codes (or as the spec was designed, on a teletype), CR+LF is correct, and LF is not.

However, the inconsistencies of this over time have become really annoying. My long term pet peeve is in VB.NET when I have to do this:

  ' This works - using the VB6 interop
  Split(StringName,vbCrLf)  
  
  ' This doesn't work - using the native .NET function
  ' because .split is only expecting a Char, and not a String)
  StringName.Split(vbCrLf)
Really, really annoying.
Why would you want strings to be formatted using terminal codes? It's just textual data. It has nothing to do with terminals, other then the fact that terminals need to handle text. I see little reason that text should have to handle terminals.

With that said, CR+LF is just inefficient, since doing both of those tasks together is what is overwhelmingly desired for a newline.

\r\n has always seemed redundant, regardless of the standards.

I get using \r without \n for fun rewriting of a current line of text on a terminal.

But has anyone (in recent years) honestly want a new line, without a carriage return?

And why did all the internet protocols settle on this? It's an extra 8bits that are unnecessary.