-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
I found a difference in behavior between MRI and JRuby.
Environment Information
Provide at least:
- jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64ba Java HotSpot(TM) 64-Bit Server VM 25.271-b09 on 1.8.0_271-b09 +jit [darwin-x86_64]
- Darwin atelier.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
Expected Behavior
The following is an example:
# example.rb
require 'stringio'
Encoding.default_external = 'ASCII'
io = StringIO.new
io << '©'
p io.string
p io.string.encodingThis is behavior of MRI 2.5.7 (and MRI 3.0.0) .
% ruby -v
ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-darwin19]
% ruby example.rb
"\u00A9"
#<Encoding:UTF-8>% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
% ruby example.rb
"\u00A9"
#<Encoding:UTF-8>Actual Behavior
This is behavior of JRuby 9.2.14.0.
% ruby -v
jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64bafb9 Java HotSpot(TM) 64-Bit Server VM 25.271-b09 on 1.8.0_271-b09 +jit [darwin-x86_64]
% ruby example.rb
"\xC2\xA9"
#<Encoding:US-ASCII>I encountered this issue in RuboCop.
rubocop/rubocop#9347
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels