Forum: Ruby-core [ruby-trunk - Bug #7979][Open] File.foreach splits on 'r' in windows

Posted by ninjabus (Steve Kingston) (Guest)
on 2013-02-27 19:18
(Received via mailing list)
Issue #7979 has been reported by ninjabus (Steve Kingston).

----------------------------------------
Bug #7979: File.foreach splits on 'r' in windows
https://bugs.ruby-lang.org/issues/7979

Author: ninjabus (Steve Kingston)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3


Calling File.foreach('somefile.txt', "r") on a windows platform adds 
newline characters after each lower case 'r', splitting the read lines 
after each instance.
Reading the following file
"""
This contains r characters
Wreck it Ralph
"""

outputs

"""
This contains r
 character
s
Wr
eck it Ralph
"""
Posted by Nobuyoshi Nakada (nobu)
on 2013-03-02 16:45
(Received via mailing list)
Issue #7979 has been updated by nobu (Nobuyoshi Nakada).

Description updated
Status changed from Open to Rejected

The second argument is a line separator to split the input.
----------------------------------------
Bug #7979: File.foreach splits on 'r' in windows
https://bugs.ruby-lang.org/issues/7979#change-37258

Author: ninjabus (Steve Kingston)
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3


=begin
Calling (({File.foreach('somefile.txt', "r")})) on a windows platform 
adds newline characters after each lower case (({'r'})), splitting the 
read lines after each instance.
Reading the following file

  This contains r characters
  Wreck it Ralph

outputs

  This contains r
   character
  s
  Wr
  eck it Ralph
=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.