On 6/25/06, Ola Bini <[EMAIL PROTECTED]> wrote:
I understand doing the normalization internally, to simplify what signifies a "line ending" across all platforms. It seems to me that doing it on reads and writes is a rather unreliable way to do it.
OS X uses unix line terminators; only old Mac OS uses \r (and from reading a few threads, Ruby does not do anything to \r). We can safely assume that all platforms OTHER than Windows should work fine; Windows only has problems because it uses \r\n for line termination, which we do not currently normalized, which causes problems for "some reason".
It's that "some reason" I want to understand.
Well, actually, it isn't as easy as that. The fundamental problem isn't
that Ruby is 'changing' something on win32 but not on *nix. The problem
is that Ruby's internal newline format happens to be the same as *nix
(for some _VERY_ strange reason... =)
I understand doing the normalization internally, to simplify what signifies a "line ending" across all platforms. It seems to me that doing it on reads and writes is a rather unreliable way to do it.
What this means is that Ruby will change FROM line-separator into \n
regardless of platform. But on *nix this doesn't matter, it's from \n
into \n. On win32 it's \r\n into \n, but only for non-binary
reading/writing. I'm also pretty sure that this behaviour will be \r
into \n on MacOS X. I tend to agree with this policy for reading, but
not for writing, but I guess that isn't really the issue.
OS X uses unix line terminators; only old Mac OS uses \r (and from reading a few threads, Ruby does not do anything to \r). We can safely assume that all platforms OTHER than Windows should work fine; Windows only has problems because it uses \r\n for line termination, which we do not currently normalized, which causes problems for "some reason".
The problem with rails and newlines isn't really a problem with rails,
it's a problem with regexps. Rails uses ERb for templating, and ERb uses
a StringScanner, which uses regexps to find the first newline, or EOF,
whatever comes first. On my win32 box, this results in the wrong
behaviour, for some reason. So I'm pretty sure it would be hard to
It's that "some reason" I want to understand.
change that behaviour without actually reading and writing newlines as C
Ruby does it.
/O
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Jruby-devel mailing list Jruby-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jruby-devel