summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 032f80a840..26dc1a099a 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -1149,7 +1149,8 @@ strio_gets(int argc, VALUE *argv, VALUE self)
VALUE str;
if (prepare_getline_args(&arg, argc, argv)->limit == 0) {
- return rb_str_new(0, 0);
+ struct StringIO *ptr = readable(self);
+ return rb_enc_str_new(0, 0, get_enc(ptr));
}
str = strio_getline(&arg, readable(self));