Those pesky carriage returns

Started by tom, November 03, 2004, 02:47:00 PM

Previous topic - Next topic

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

#1
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

#2
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

#3
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