Issue #9765 has been updated by Tomoyuki C…
Backport changed from 2.0.0: DONE, 2.1: REQUIRED to 2.0.0: DONE, 2.1:
DONE
r45646 was backported into ruby_2_1
branch at r46197.
Bug #9765: StringIO#putc is unnaware of encoding
- Author: Nobuyoshi N.
- Status: Closed
- Priority: Normal
- Assignee: Nobuyoshi N.
- Category: ext
- Target version: current: 2.2.0
- ruby -v: r45637
- Backport: 2.0.0: DONE, 2.1: DONE
IO#putc
はエンコーディングを意識しますが、StringIO#putc
がしていません。
IO.pipe{|r,w| w.putc("\u{3042}"); w.putc(0x3044); w.close; p r.read}
# => "あD"
require 'stringio'
sio = StringIO.new(""); sio.putc("\u{3042}"); sio.putc(0x3044); p
sio.string
# => "\xE3D"