Project

General

Profile

Bug #20416

Updated by Eregon (Benoit Daloze) 8 months ago

`IO#read(nil, buffer)` doesn't change buffer's encoding, but it does when `maxlen` parameter is specified: 

 ```ruby 
 buffer = "".encode(Encoding::ISO_8859_1) 
 p 

 File.open("test.rb").read(1000, buffer).encoding # => #<Encoding:ISO-8859-1> 

 buffer = "".encode(Encoding::ISO_8859_1) 
 p File.open("test.rb").read(nil, buffer).encoding    # => #<Encoding:UTF-8> 
 ``` 

 I would expect changing buffer encoding in all the cases.

Back