Actions
Bug #20418
closed`StringIO#read(..., buffer)` doesn't preserve buffer's encoding
Description
IO#read (and similar methods #read_nonblock
, #readpartial
, #sysread
) when called with a buffer
argument preserve its encoding. But StringIO#read
doesn't do so:
file = File.open('test.rb')
buffer = "".encode(Encoding::ISO_8859_1)
file.read(10, buffer)
buffer.encoding # => #<Encoding:ISO-8859-1>
require 'stringio'
io = StringIO.new("# encoding")
buffer = "".encode(Encoding::ISO_8859_1)
io.read(10, buffer)
buffer.encoding # => #<Encoding:ASCII-8BIT>
I would expect StringIO's read and similar methods to preserve a buffer's encoding.
Actions
Like0
Like1Like0