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

String#unpack: Unpacked string should not have an encoding #4481

Closed
janlelis opened this issue Feb 7, 2017 · 0 comments
Closed

String#unpack: Unpacked string should not have an encoding #4481

janlelis opened this issue Feb 7, 2017 · 0 comments

Comments

@janlelis
Copy link

janlelis commented Feb 7, 2017

Environment

  • ruby -v jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-02-06 3f97c7a Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +indy +jit [linux-x86_64]
  • uname -a Linux ok 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Expected Behavior

  • Should not set any encoding on the unpacked string, since it is an unknown binary string
  • MRI example with ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]:
$ ruby -e 'p "1".encoding; p "1".unpack("a*")[0].encoding'
#<Encoding:UTF-8>
#<Encoding:ASCII-8BIT>

Actual Behavior

  • JRuby seems to convert to my encoding implicitly:
$ ruby -e 'p "1".encoding; p "1".unpack("a*")[0].encoding'
#<Encoding:UTF-8>
#<Encoding:UTF-8>
@kares kares self-assigned this Feb 9, 2017
@kares kares added this to the JRuby 9.1.8.0 milestone Feb 9, 2017
@kares kares closed this as completed in 507d226 Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants