Skip to Content
Mac OS X Hacks
book

Mac OS X Hacks

by Kevin Hemenway, Rael Dornfest
March 2003
Beginner
432 pages
11h 30m
English
O'Reilly Media, Inc.
Content preview from Mac OS X Hacks

A Line Break Is a Line Break

A line break is a line break is a line break, except when it’s not. Surprisingly, there are three different types of line breaks in the modern computing world, and OS X uses two of the three.

One might think the innocent line break, that docile whitespace that tells us when paragraphs begin and end, would be a relatively simple piece of computer engineering. Unfortunately, there’s more to the line break than meets the eye.

There are three different types of line breaks, all originally unique to the major operating systems: Windows/DOS, Macintosh, and Unix. A document using Mac line breaks would look horrid on a Windows system, and a document using Windows line breaks on Unix also wouldn’t be interpreted correctly. The cause for this is how the line break is actually created. The Mac, by default, uses a single carriage return (<CR>), represented as \r. Unix, on the other hand, uses a single linefeed (<LF>), \n. Windows goes one step further and uses both, creating a (<CRLF>) combination, \r\n.

To make matters still more interesting, until OS X came along, OS-specific line breaks stayed in their own environment and didn’t play nicely with others. Windows understood only its brethren, Unix cackled madly at anything else, and the Mac just grinned knowingly. OS X, however, understands both the original Mac line break and Unix line breaks.

This can cause confusion very easily, especially considering that most Mac applications (i.e., most anything ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro Oracle Database 11g RAC on Linux

Pro Oracle Database 11g RAC on Linux

Steve Shaw, Martin Bach
Linux Recipes for Oracle DBAs

Linux Recipes for Oracle DBAs

Darl Kuhn, Charles Kim, Bernard Lopuz
Enduring CSS

Enduring CSS

Ben Frain
UNIX° TEXT PROCESSING

UNIX° TEXT PROCESSING

Dale Dougherty, Tim O'Reilly

Publisher Resources

ISBN: 0596004605Catalog PageErrata