[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cross-platform newlines in multiline strings
- From: Edgar Toernig <froese@...>
- Date: Sat, 3 Apr 2004 06:01:07 +0200
Aaron Brown wrote:
>
> That wouldn't be quite what I expected, but let me exhaust
> some possibilities and you can correct me if I'm wrong on
> any of them
Here's what I did it in Sol: three different line endings
that get converted to \n:
Unix-style: LF (0x0a)
Mac-style: CR (0x0d)
DOS-style: CR LF (0x0d 0x0a)
The sequence LF CR is interpreted as two EOLs, a Unix-EOL
followed by a Mac-EOL. I'm not aware of any system that
uses this sequence as a single EOL.
> I'm guessing that all of the following
>
> <X> <NL> <NL> <X>
> <X> <NL> <CR> <NL> <CR> <X> [??? not CR NL CR NL ???]
> <X> <CR> <CR> <X>
> <X> <NL> <CR> <NL> <CR> <X>
>
> will be treated as
>
> <X> <NL> <NL> <X>
Not in Sol. Lines 2 and 4 become <X>\n\n\n<X> (Unix-DOS-Mac).
[If you swap the NLCRs in line 2 then it becomes <X>\n\n<X>]
Further, I added Ctrl-Z (0x1a) as an EOF character as it is
under DOS and I limited identifiers to ASCII-chars.
With these changes, scripts are binary compatible between
the three system types, need no conversion and generate the
same code.
Ciao, ET.