diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-23 07:56:20 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-23 07:56:20 +0000 |
commit | e7d83904cb0698d304fb8631ca34d4434152fd17 (patch) | |
tree | ba39632fd5558b388a80a10758c633b799ae9766 /io.c | |
parent | 4c9968c9d9775a442346b0bd6d53e4bd95f69c15 (diff) |
* io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specified
with opthash. [ruby-core:42197] [Bug #5917]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -4859,10 +4859,13 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, else { VALUE v; extract_binmode(opthash, &fmode); + if (fmode & FMODE_BINMODE) { #ifdef O_BINARY - if (fmode & FMODE_BINMODE) oflags |= O_BINARY; #endif + if (!has_enc) + rb_io_ext_int_to_encs(rb_ascii8bit_encoding(), NULL, &enc, &enc2); + } if (!has_vmode) { v = rb_hash_aref(opthash, sym_mode); if (!NIL_P(v)) { |