Carriage Return vs. Newline vs. Linefeed

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
hatchmo
Posts: 99
Joined: 2004-03-01 10:35:56
Location: Cotati, CA

Carriage Return vs. Newline vs. Linefeed

Post by hatchmo »

NWX 2.x.x is making it impossible for me to create <b>tab-delimited text files</b> that will import into some applications (such as Now-Up-to-Date).

A file saved as TEXT/ASCII by Nisus Writer places a <b>Linefeed (hex 0A)</b> at the end of every line, instead of a <b>Carriage Return (hex 0D)</b>. Several applications return an error, unable to recognize that as a return (because it actually is not a return character).

How can I save files in NW that will insure a <b>CR</b> at the end of every line?
Al Hatch
JBL
Posts: 170
Joined: 2003-04-25 14:33:59

Post by JBL »

It looks to me like replacing \n with \r in PowerFind Pro and then saving as text does the job.
dshan
Posts: 334
Joined: 2003-11-21 19:25:28
Location: Sydney, Australia

Post by dshan »

Welcome to Mac OS X. In line with other Unix-based OS's Mac OS X uses the linefeed char to denote end-of-line in text files whereas the old classic Mac OS used the totally non-standard carriage-return character. All Cocoa apps that produce text files use (or should use) the linefeed character by default (see TextEdit for example). MS-DOS/Windows has always used the old carriage-return & linefeed combination (dating from old teletype machines!) to perform the same function.

Needless to say this madness has caused endless problems when it comes to transferring simple text files from one OS to another. At least now there's only two variations to worry about, unless you are using Classic Mac OS apps of course...

Several 3rd party text editors - Tex-Edit Plus and Text Wrangler for example - can handle and convert the various end-of-line markers and there are shareware utils like Stripper that can convert files from one format to another too.
hatchmo
Posts: 99
Joined: 2004-03-01 10:35:56
Location: Cotati, CA

Post by hatchmo »

I actually own BBEdit, but I think a simple \n-to-\r macro will make my life easier, by allowing me to stay in Nisus Writer.

My thanks to both of you.
Al Hatch
Post Reply