From: Xavier Noria Date: 2006-08-01T01:39:57+09:00 Subject: Re: Does Ruby need a "line separator" class? On Jul 31, 2006, at 6:15 PM, Charles O Nutter wrote: > 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. If I am not mistaken, in Ruby that is delegated to stdio. After a quick code inspection I think the exact point where that is done is in the call to write(): r = write(fileno(f), RSTRING(str)->ptr+offset, l); That's in the function io_fwrite(), line 455 of io.c in Ruby 1.8.4. In Perl that was delegated to stdio as well until 5.8.0, where the I/ O layer was substituted with PerlIO who is now the responsible for that filtering in CRLF platforms. -- fxn