summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 8b5db0e066..7f8733f031 100644
--- a/io.c
+++ b/io.c
@@ -4101,7 +4101,7 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc,
intern = rb_default_internal_encoding();
if (intern == NULL || intern == (rb_encoding *)Qnil || intern == ext) {
/* No internal encoding => use external + no transcoding */
- *enc = default_ext ? NULL : ext;
+ *enc = (default_ext && intern != ext) ? NULL : ext;
*enc2 = NULL;
}
else {