Those pesky carriage returns

Q&A's, tips, howto's
Locked
tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Those pesky carriage returns

Post by tom »

Howdy.

I just noticed that pages generated locally on my linux box, by newlisp wiki, include ugly carriage returns. Is there anyway to make newlisp simply "do the right thing" about line endings based on the operating system?

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

newLISP defines line feeds on Linux/UNIX as 0xA (LF) and only on Win32 as 0xD+0xA (CR-LF) when using 'println' and 'write-line' functions. The newlisp.org website and newlisp.org/wiki demo site both run on FreeBSD which is a UNIX and look fine in common browsers.

But when generating HTTP headers CR-LF sequneces are used for end-of-line markers, which is how HTTP 1.1 defines it. As of HTTP 1.1 CR-LF and LF only should both be tolerated for line terminators in the entity body.

Lutz

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

Thanks Lutz,

I'm using the wiki locally, and editing the pages directly, for the
most part. Every now and then I'll have the wiki generate whatever
page, to see how everything is looking, then go back to direct
editing. Guess what's there when I "return?" CRs. Can I force only
LFs somehow?

It's not that important, a "yes or no" would be great. Usually, the
behavior would be fine--for me right now, it's a bit of a nuisance.

Thanks!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Short answer "no". Long answer: some routines parsing the text to replace wiki formatting etc., rely on CR-LF as line terminators. But it should be relative streight forward to change this to your liking. I think it only happens when splitting lines.

There is also another issue to be aware of: all browsers submit the text in multiple line HTML edit controls with CR-LF line terminators. In newlisp-ide-xxx.tgz I am replacing those with LF, to be able to edit UNIX shell scripts, but in the wiki I am not doing this.

Lutz

Locked