IBM, DOS and Windows Newlines

There were competing conventions when it came how to handle newlines in character encoding. Some manufacturers like International Business Machines (IBM) chose to implement newlines using a character return characters followed by a newline character - \r\n.

It made sense for IBM to standard on one way of doing this so they could continue to service and upgrade their customers to new printers. Helping their early customers automate printing off utility bills, bank statements etc. was a huge part of their business.

Even though later printer technology could have handled a newline operation with a single control character like \n it would have been very expensive to change this standard for IBM.

So this became a standard part of how their operating systems worked and when they contracted Microsoft to supply the first operating system for their personal computers - DOS it made sense for DOS to follow the same convention.

When Microsoft introduced Windows, Windows also had to use \r\n for a newline to make it compatible with DOS.

Unix went a different direction. They used a simpler system of representing a newline with just \n. This the convention that Linux follows since Linux was a open source implementation of Unix design and also for Mac OS X since OS X is based on the FreeBSD flavour of unix.

Â