summaryrefslogtreecommitdiff
path: root/ext/stringio/stringio.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-13 07:21:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-13 07:21:13 +0000
commit24d03b22046ec02e7abd71f2a5ac443d9bd50699 (patch)
tree7b3a6505f3c749305b3913282cb33242c1753764 /ext/stringio/stringio.c
parentc5f66a376ff02886be62348469574a5bd4e8f6b2 (diff)
stringio.c: encoding at empty result
* ext/stringio/stringio.c (strio_gets): should return string with the external encoding, at empty result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-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 032f80a..26dc1a0 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));