------art_28400_4456435.1154362540020
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 7/31/06, Xavier Noria <fxn / hashref.com> wrote:
>
> On Jul 31, 2006, at 5:40 PM, Wes Gamble wrote:
>
> > I've run into a problem where Ruby can't handle newlines on Windows
> > because the regexp is explicitly looking for \n and not \r\n.
>
> It shouldn't look for CRLFs. The rules of the game in languages that
> inherit the newline normalization approach from C (those include C++,
> and Perl, for instance, but not Java) are that if you work in text
> mode and the text file follows runtime conventions, you only read and
> print "\n"s.
>
> That's because there's an intermediate IO layer that transforms CRLF
> into LF in CRLF platforms on reading, and LF back to CRLF on writing.
>

This has come up in the JRuby project fairly frequently since Java wants to
normalize line-terminators internally to the underlying platform, rather
than normalizing to \n and handling conversion on read-write. Xavier, are
you saying that Ruby has in its IO layer code to convert from CRLF to LF on
input/output, and this is the primary means of normalizing newlines? We have
had in our bug tracker a patch that resolves JRuby's newline issues in a
similar way, but had not committed it pending research into whether this
would be appropriate and sufficient.

-- 
Contribute to RubySpec! @ www.headius.com/rubyspec
Charles Oliver Nutter @ headius.blogspot.com
Ruby User @ ruby.mn
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com

------art_28400_4456435.1154362540020--