Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO#set_encoding returns nil instead of itself #4712

bfontaine opened this issue Jul 10, 2017 · 0 comments

IO#set_encoding returns nil instead of itself #4712

bfontaine opened this issue Jul 10, 2017 · 0 comments


Copy link


$ jruby -v
jruby (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [darwin-x86_64]
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
$ uname -a
Darwin mbf.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

Expected Behavior

$stdin.set_encoding(Encoding::UTF_8) should return itself, just like in MRI:

$ irb
>> $stdin.set_encoding(Encoding::UTF_8)
=> #<IO:<STDIN>>

Actual Behavior

$stdin.set_encoding(Encoding::UTF_8) returns nil (as we can see here).

This one-liner shows the issue:

puts $stdin.set_encoding(Encoding::UTF_8) ? "ok" : "not ok"
$ ruby set_encoding.rb
$ jruby set_encoding.rb
not ok

Is there a reasoning behind this, or is this a bug?

@kares kares added this to the JRuby milestone Jul 11, 2017
@enebo enebo closed this as completed in 4d1db6f Jul 11, 2017
enebo added a commit that referenced this issue Jul 11, 2017
IO#set_encoding should return self (fixes #4712)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants