Bug #3058: Inconsistent eol conversion of IO#read on Windows
http://redmine.ruby-lang.org/issues/show/3058

Author: Heesob Park
Status: Open, Priority: Normal
Category: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2010-03-31 trunk 27123) [i386-mswin32_90]

I found that IO#read(length) don't convert "\r\n" to "\n" on 1.9.x


On ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]

irb(main):001:0> File.open('test.txt','r').read
=> "test\n"
irb(main):002:0> File.open('test.txt','rb').read
=> "test\r\n"
irb(main):003:0> File.open('test.txt','r').read(8)
=> "test\n"
irb(main):004:0> File.open('test.txt','rb').read(8)
=> "test\r\n"


On ruby 1.9.2dev (2010-03-31 trunk 27123) [i386-mswin32_90]

irb(main):001:0> File.open('test.txt','r').read
=> "test\n"
irb(main):002:0> File.open('test.txt','rb').read
=> "test\r\n"
irb(main):003:0> File.open('test.txt','r').read(8)
=> "test\r\n"
irb(main):004:0> File.open('test.txt','rb').read(8)
=> "test\r\n"

I think that File.open('test.txt','r').read(8) should be "test\n".


----------------------------------------
http://redmine.ruby-lang.org