summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-04-10 19:06:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-04-10 19:08:15 +0900
commit5cac9c847806707c4d651d3563e5723a7b4ccee7 (patch)
tree0f9fbb7f951bbc7946a8c6cd8e9cf51f44c9ae32
parent8fa1ff9a03e1331a12408cece0f07f367be9ae1b (diff)
downloadmruby-5cac9c847806707c4d651d3563e5723a7b4ccee7.tar.gz
mruby-5cac9c847806707c4d651d3563e5723a7b4ccee7.zip
io.rb: fix `IO#getbyte` to work with UTF-8 characters; ref #5389
-rw-r--r--mrbgems/mruby-io/mrblib/io.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb
index 8d00c316d..a60562846 100644
--- a/mrbgems/mruby-io/mrblib/io.rb
+++ b/mrbgems/mruby-io/mrblib/io.rb
@@ -305,9 +305,9 @@ class IO
end
def getbyte
- ret = getc
- return ret.getbyte 0 if ret
- ret
+ readbyte
+ rescue EOFError
+ nil
end
# 15.2.20.5.3