diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/stringio/stringio.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 23c4356f97..bd83ea207b 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -493,7 +493,18 @@ strio_set_lineno(VALUE self, VALUE lineno) return lineno; } -#define strio_binmode strio_self +static VALUE +strio_binmode(VALUE self) +{ + struct StringIO *ptr = StringIO(self); + rb_encoding *enc = rb_ascii8bit_encoding(); + + ptr->enc = enc; + if (WRITABLE(self)) { + rb_enc_associate(ptr->string, enc); + } + return self; +} #define strio_fcntl strio_unimpl |