Scott Hanselman

Death to Carriage Returns and Linefeeds

August 24, 2006 Comment on this post [8] Posted in Musings | Subversion
Sponsored By

Labels_typewriter130 years later and the typewriter is still slowing me down. When you type on a typewriter (for those of you under 25(?) who've never seen one) and reach the end of a line you grasp the "carriage return bar" which would return the carriage to the home position while simultaneously rotating the platen to feed the paper.

Aside: I spent the better part of the summer 1985 manually typing up the screenplay to Ghostbusters (as a reference material) on a manual Smith-Corona Typewriter.

Fast-forward to Teletype machines and now the carriage return/line feed combination is encoded into the wire protocol, then baked into ASCII text encoding itself in the 60s.

Fast-forward to lunchtime today when I was trying to commit some user-submitted changes to DasBlog via TortoiseSVN and got this fantastic error message "Commit failed: file has inconsistent newlines." What application would be so clever as to patch a file with consistent CR/LF pairs with a band-aid of just LFs? Why TortoiseMerge of course! But I'm not bitter.

Badnewlines1

How do you fix something like this? Well, a number of ways.

Here's screenshots of the same file opened in Notepad++ and Notepad2.

Bad newlines in Notepad++

Bad newlines in Notepad2

Notepad2 shows the the CR/LF status in the status bar and also optionally at the end of each line. It also lets you switch line endings by simply double clicking on the status bar indicator. Slick. Anyway, crisis averted and changes successfully committed. 

Will we ever be rid of this problem?

No, just like Intel will always been little-endian while the rest of the world will be big-endian. As an unrelated aside from Alex McLellan:

The terms big-endian and little-endian were taken from the Big-Endians and Little-Endians of Gulliver’s Travels, when Lilliput and Blefuscu Gulliver finds two factions fighting over which end of a boiled egg should be cracked open.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
August 24, 2006 1:43
Scott, I feel your pain! Come and help me fight this ecological disaster ;-)

http://www.apptranslator.com/blog/2005/04/save-planet-stop-converting-crlfs.html
August 24, 2006 2:37
Have you tried svn:eol-style ?
August 24, 2006 2:40
AH...I haven't, but it sounds dangerous. Seems like it'd only matter if I was doing Linux/Windows cross-development
August 24, 2006 3:55
hi there,

intersting post.

"INTEL always little -endian" : Itanium can be either big or little.
ia64l - Intel Itanium little endian
ia64b - Intel Itanium big endian (IA64 line)

BR,
~A
August 24, 2006 4:58
Anjan, sure, I "simplified" by ignoring Itanium, but doens't everyone? Sure Intel has other chips that are differently endianed, but do they matter? Isn't Itanium kind of fading away?
August 24, 2006 9:21
Not related to Tortoise; I love both Notepad++ and Notepad2. What I'd really love is Notepad2 to have multiple doc support like Notepad++, or Notepad++ to be a single file exe like Notepad2...
August 24, 2006 14:07
Bizarrely, I also spent the summer of 1985 typing up Ghostbusters on my old manual typewriter. The only thing I took away from the task is that my typing improved and that I should call 555-2368 if I ever get into trouble. I'm so glad the internet didn't exist when I was a child or I would have ended up getting even more obsessed with stupid things than I do now.

Or maybe I wouldn't - maybe knowing that I could download the screenplay from somewhere would have stopped me from carrying out this monumental task. Seeing the speed Scott types he'd obviously have had it finished before me (especially if he had CodeRush installed on his Smith-Corona typewriter) and I'd have been able to download it from him.

I often worry how kids today will get into programming. In my youth it was from typing out (and debugging) programs from the back of computing magazines so that I would have a game to play. Now that the average game take several man years of effort from incredibly skilled multidisciplinary people what is going to hook the kids in?

Wow - that's an off topic comment. Better go get myself a nice cup of tea and get back to work.
October 06, 2006 17:02
I happen to hit 20 the same day of the blog and I am happy to say that I did do typerwriter training a long time ago :)

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.