diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-05 22:26:39 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-05 22:26:39 +0000 |
commit | dc5f9c4b88826cc4f0042abf74dc368a6c3c783b (patch) | |
tree | 78915355a05513722adcde9be7648a5c1e837046 /io.c | |
parent | 525cce4dd3016bb39a7eb0e05ac7de113b4b2c68 (diff) | |
download | ruby-dc5f9c4b88826cc4f0042abf74dc368a6c3c783b.tar.gz ruby-dc5f9c4b88826cc4f0042abf74dc368a6c3c783b.tar.xz ruby-dc5f9c4b88826cc4f0042abf74dc368a6c3c783b.zip |
* io.c (rb_io_extract_modeenc): raise an error for ASCII incompatible
encoding without binmode.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3898,6 +3898,9 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE opthash, if ((fmode & FMODE_BINMODE) && (fmode & FMODE_TEXTMODE)) rb_raise(rb_eArgError, "both textmode and binmode specified"); + if (enc && !rb_enc_asciicompat(enc) && !(fmode & FMODE_BINMODE)) + rb_raise(rb_eArgError, "ASCII incompatible encoding needs binmode"); + *vmode_p = vmode; *oflags_p = oflags; |