Actions
Bug #19235
closedStringIO.new(encoding: "ext_enc:int_enc") doesn't set external encoding
Bug #19235:
StringIO.new(encoding: "ext_enc:int_enc") doesn't set external encoding
Description
I noticed a divergence between IO :encoding
option documentation and StringIO's behaviour:
io = StringIO.new('', 'w', encoding: 'utf-8:ISO-8859-1')
io.external_encoding # => #<Encoding:ISO-8859-1>
According to the documentation:
:encoding: Specifies external and internal encodings as 'extern:intern'.
The IO class behaves in expected way:
f = File.open("test.txt", 'w', encoding: 'UTF-8:ISO-8859-1')
f.external_encoding # => #<Encoding:UTF-8>
Actions