See also:
- CSS Generated Content : Revisited [ WordPressCenter.net ]
- Character Set (aka. charset) vs. Character Encoding [ WordPressCenter.net ]
- Proposed Solution to Charset Problems [ WordPressCenter.net ]
- Using the Line Feed Control in CSS Generated Content [ WordPressCenter.net ]
Cutting Lines
If you have any experience in programming, or even in simply writing HTML markup, you have probably come across the need to use a specified Line Break Control Character. It can be confusing as to when and where one should be used over the other.
ASCII(1)
One of the all-time-most-common standards of recent years is ASCII. According to Wikipedia:
Software applications and operating systems usually represent a newline with one or two control characters:
- Systems based on ASCII or a compatible character set use either LF (Line Feed, 0x0A) or CR (Carriage Return, 0x0D) individually, or CR followed by LF (CR+LF, 0x0D 0x0A); see below for the historical reason for the CR+LF convention.
- LF: Unix and Unix-like systems, GNU/ Linux, AIX, Xenix, Mac OS X, BeOS, Amiga, RISC OS and others
- CR+LF: CP/M, MP/M, DOS, OS/2, Microsoft Windows
- CR: Commodore machines, Apple II family and Mac OS up to version 9
From my own knowledge on the subject, I know the ASCII Control Character is an important weapon of your arsenal. More info on the ASCII Control Characters can be found at another of my favourite resources, Answers.com
Unicode(1)
The the Wikipedia Entry, Newline provides a nice chronology, if not somewhat latitudinal snapshot, of the history of cutting new lines:
The Unicode standard addresses the problem by defining a large number of characters that conforming applications should recognize as line terminators: LF: Line Feed, U+000A CR: Carriage Return, U+000D CR+LF: CR followed by LF, U+000D followed by U+000A NEL: Next Line, U+0085 FF: Form Feed, U+000C LS: Line Separator, U+2028 PS: Paragraph Separator, U+2029
so we’ve got a lot to work with right there.
the “C” Language Newline Character: The One(1)
More commonly known as “Newline” character is the one which in our source code text editors we represent as a “backslash” and an “n” which, again according to the Wikipedia Entry Newline:
The C programming language provides the escape sequences ‘\n’ (newline) and ‘\r’ (carriage return). However, contrary to popular belief, these are in fact not required to be equivalent to the ASCII LF and CR control characters.
So there we have it. Certainly more than a handfull, and apparently none of it is a waste!
Visit the Wikipedia entry i’ve cited so much here, and examine the complete text. You might also have a look at the W3C(2) recommendation on Controlling Line Breaks, which states:
A line break is defined to be a carriage return (
),
a line feed (
), or a carriage return/line feed pair. All line
breaks constitute white space.For more information about SGML’s specification of line breaks, please
consult the notes on line
breaks
Confused? Put a BabelFish in Your Ear
If you really want to go nuts with Unicode, ASCII, ANSI, and more Control Characters than you can shake a stick at, check out the Babel Stone Software, BabblePad for Windows (also functional when run on WinE, the free Linux Windows 32bit emulator). If not for the software itself,
it’s worth visiting http://www.babelstone.co.uk/ for more info about BabelStone software developer, Andrew West, and his extensive contributions to Unicode.
The Commodore found an Apple near the Window
The Wikipedia article which seemed in summation to be perhaps the best singular reference is titled Newline (see citation below). The article breaks down into several sub-categories, the topic of new-line recognition in programming and computer languages. It would be nice if there was on single way of stating “Hey Everyone! This is a New Line!”, but it is far from that simple, and the evolution of technology has sometimes intentionally obfuscated the otherwise more easily transcribed notion of “new line”.
Our generation is fortunate to have the Wikipedia. Some of the best minds on Earth contribute to the thing, and often some of the most obscured subjects are covered there in great detail, so i always give it a fair shake when it comes to referencing topics in the more elusive categories– and so have i here.
References:
1Wikipedia contributors. Newline. Wikipedia, The Free Encyclopedia. February 9, 2007, 15:11 UTC. Available at: http://en.wikipedia.org/w/index.php?title=Newline&oldid=106844740. Accessed February 27, 2007.
2the World Wide Web Consortium. HTML 4.01 Specification. December 1999. Available at: http://www.w3.org/TR/html401/struct/text.html#line-breaks
Leave a Reply