Project

General

Profile

Actions

Bug #3058

closed

Inconsistent eol conversion of IO#read on Windows

Added by phasis68 (Heesob Park) about 12 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
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 #1

Updated by matz (Yukihiro Matsumoto) about 12 years ago

=begin
Hi,

In message "Re: [ruby-core:29161] [Bug #3058] Inconsistent eol conversion of IO#read on Windows"
on Wed, 31 Mar 2010 18:37:35 +0900, Heesob Park writes:

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

On 1.9, newline conversion has moved from stdin wrapper to encoding
translation layer, which stop working on binary read, so it's intended
feature.

						matz.

=end

Actions #2

Updated by phasis68 (Heesob Park) about 12 years ago

=begin
Hi,

2010/4/5 Yukihiro Matsumoto :

Hi,

In message "Re: [ruby-core:29161] [Bug #3058] Inconsistent eol conversion of IO#read on Windows"
   on Wed, 31 Mar 2010 18:37:35 +0900, Heesob Park writes:

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

On 1.9, newline conversion has moved from stdin wrapper to encoding
translation layer, which stop working on binary read, so it's intended
feature.

I understand the feature.
But, in that case, the document of ios.read(length [,buffer]])
must be stated the difference when length is present or omitted.

Regards,
Park Heesob

=end

Actions #3

Updated by naruse (Yui NARUSE) about 12 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27604.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF