Project

General

Profile

Actions

Bug #3058

closed

Inconsistent eol conversion of IO#read on Windows

Added by phasis68 (Heesob Park) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2010-03-31 trunk 27123) [i386-mswin32_90]
Backport:
[ruby-core:29161]

Description

=begin
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".
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0