Issue #9765 has been reported by Nobuyoshi Nakada.

----------------------------------------
Bug #9765: StringIO#putc is unnaware of encoding
https://bugs.ruby-lang.org/issues/9765

* Author: Nobuyoshi Nakada
* Status: Assigned
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: r45637
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
`IO#putc`はエンコーディングを意識しますが、`StringIO#putc`がしていません。

~~~ruby
$ ruby -e 'IO.pipe{|r,w| w.putc("\u{3042}"); w.putc(0x3044); w.close; p r.read}'
"あD"

$ ruby -rstringio -e 'sio = StringIO.new(""); sio.putc("\u{3042}"); sio.putc(0x3044); p sio.string'
"\xE3D"
~~~



-- 
https://bugs.ruby-lang.org/