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

Closed
bfontaine opened this Issue Jul 10, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@bfontaine

bfontaine commented Jul 10, 2017

Environment

$ jruby -v
jruby 9.1.12.0 (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
ok
$ jruby set_encoding.rb
not ok

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

@kares kares added this to the JRuby 9.2.0.0 milestone Jul 11, 2017

@enebo enebo closed this in 4d1db6f Jul 11, 2017

enebo added a commit that referenced this issue Jul 11, 2017

Merge pull request #4713 from MSNexploder/set_encoding
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