summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-08 08:47:26 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-08 08:47:26 +0000
commit4834aa5307d8c4750b7598b6b2ef8728d01d98b4 (patch)
tree3d4339c6e04d7cd902072637e9d7fc25a60e5573 /io.c
parentce573f3166d8b80d6a0b9c6c027b0c5e10f05c4b (diff)
* io.c (rb_io_ext_int_to_encs): ignore internal encoding if external
encoding is ASCII-8BIT. [Bug #8342] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/io.c b/io.c
index 2b605336bf..8676293a40 100644
--- a/io.c
+++ b/io.c
@@ -4868,9 +4868,13 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc,
ext = rb_default_external_encoding();
default_ext = 1;
}
- if (intern == NULL && ext != rb_ascii8bit_encoding())
- /* If external is ASCII-8BIT, no default transcoding */
+ if (ext == rb_ascii8bit_encoding()) {
+ /* If external is ASCII-8BIT, no transcoding */
+ intern = NULL;
+ }
+ else if (intern == NULL) {
intern = rb_default_internal_encoding();
+ }
if (intern == NULL || intern == (rb_encoding *)Qnil ||
(!(fmode & FMODE_SETENC_BY_BOM) && (intern == ext))) {
/* No internal encoding => use external + no transcoding */