[Smaug] CR/LF, wordwrap, newline & ASCII

Rick Moen rick at linuxmafia.com
Thu, 13 Jun 2002 11:50:31 -0700


Quoting Paul Thomas (paul@cuenet.com):

> My question is what are the differences between the way
> MicroStuff, Apple, and unix handle ASCII text.

MacOS terminates ASCII lines with CR (ASCII #13 decimal = D hex).
Unix terminates ASCII lines with LF (ASCII #10 decimal = A hex).
   (Presumably, MacOS X and Apple Darwin are exceptions.)
MS-DOS terminates ASCII lines with CR LF.

I believe "/n" is a symbolic, abstract way of saying "whatever is the 
appropriate endline sequence", rather than designating a specific 
character -- but I may be wrong.

> I notice with an Apple ASCII text file read with 'less'
> or pico, the text runs all together.

Some editors will automatically figure out endline sequences and
compensate.  But you can always fix the file with a simple "tr" filter.

> Does Apple have their own 'ascii'? I believe MS has their own 'dos
> ascii' and unix uses US ASCII.

Here, you're asking a slightly more complex question than you were
before, but probably aren't aware of that fact.

ASCII was only ever defined as a 7-bit character set.  Therefore, the
upper half of the full 8-bit character space has no standard, universal
definition.  There have been lots of mutually incompatible
upper-character sets.  IBM had one for character-mode video.  Epson had
one for printers.  MS-DOS/MS-Windows 3.1/9x/ME and probably other
Microsoft stuff had at least one totally different one.  And so on.

ASCII always sucked for much of the world, anyway -- because it omitted
some really critical characters and was highly USA-centric.  This is why
ISO 8859-1 (Latin-1) and relatives (which are basically slightly
improved ASCII) have been supplanting ASCII in the Western,
Roman-alphabet, Germanic/Romance-languages world -- and stranger things
beckon, like UTF8 and <spit> Unicode.

-- 
Cheers,   The difference between common sense and paranoia is that common sense
Rick Moen     is thinking everyone is out to get you.  That's normal; they are.
rick@linuxmafia.com      Paranoia is thinking they're conspiring.  -- J. Kegler