From: "zverok (Victor Shepelev)" <noreply@...>
Date: 2022-12-14T14:44:21+00:00
Subject: [ruby-core:111289] [Ruby master Bug#19235] StringIO.new(encoding: "ext_enc:int_enc") doesn't set external encoding

Issue #19235 has been updated by zverok (Victor Shepelev).


Though it is kinda [specified in README](https://github.com/ruby/stringio#differences-to-io) :)))

> encoding conversion is not implemented, and ignored silently.

----------------------------------------
Bug #19235: StringIO.new(encoding: "ext_enc:int_enc") doesn't set external encoding
https://bugs.ruby-lang.org/issues/19235#change-100644

* Author: andrykonchin (Andrew Konchin)
* Status: Open
* Priority: Normal
* ruby -v: 3.1.2
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I noticed a divergence between IO `:encoding` option documentation and StringIO's behaviour:

```ruby
io = StringIO.new('', 'w', encoding: 'utf-8:ISO-8859-1')
io.external_encoding # => #<Encoding:ISO-8859-1>
```

The IO class behaves in expected way:

```ruby
f = File.open("test.txt", 'w', encoding: 'UTF-8:ISO-8859-1')
f.external_encoding # => #<Encoding:UTF-8>
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/