[Closed] StringIO#putc is unnaware of encoding

Issue #9765 has been updated by Nobuyoshi N…

Status changed from Assigned to Closed
% Done changed from 0 to 100

Applied in changeset r45646.


stringio.c: non-ascii encoding

  • ext/stringio/stringio.c (strio_putc): fix for non-ascii
    encoding, like as IO#putc. [ruby-dev:48114] [Bug #9765]

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

  • 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: REQUIRED, 2.1: REQUIRED

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"

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs