From: scivola20@... Date: 2020-06-27T21:26:51+00:00 Subject: [ruby-core:98989] [Ruby master Bug#16997] IO#gets converts some \r\n to \n with universal_newline: false Issue #16997 has been reported by scivola20 (sciv ola). ---------------------------------------- Bug #16997: IO#gets converts some \r\n to \n with universal_newline: false https://bugs.ruby-lang.org/issues/16997 * Author: scivola20 (sciv ola) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin17] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Reproduction code: ``` IO.binwrite "t.csv", ("a" * 100 + "\r\n") * 100 File.open("t.csv", encoding: "BOM|UTF-8", universal_newline: false) do |input| p input.gets(nil, 32 * 1024) # => "a...a\n...\na...a\r\n...\r\n" end ``` It causes MalformedCSVError at opening CSV file with `encoding: "BOM|UTF-8": https://github.com/ruby/csv/issues/147 -- https://bugs.ruby-lang.org/ Unsubscribe: