Skip to content

double-quoted UTF8 hash key has the wrong encoding #2591

@k77ch7

Description

@k77ch7

The following test.rb works on MRI Ruby 2.2.0,
but gives the wrong encoding and ArgumentError on master.

test.rb

# encoding: utf-8
h = { "Ãa1":  true }
puts h.keys.first.encoding
puts h

MRI Ruby 2.2.0

$ ruby ~/development/test.rb
UTF-8
{:Ãa1=>true}

JRuby master

$ jruby ~/development/test.rb
US-ASCII
ArgumentError: invalid byte sequence in US-ASCII
     inspect at org/jruby/RubySymbol.java:241
     inspect at org/jruby/RubySymbol.java:230
     inspect at org/jruby/RubyHash.java:844
        to_s at org/jruby/RubyHash.java:909
        puts at org/jruby/RubyIO.java:2406
        puts at org/jruby/RubyKernel.java:542
  __script__ at /Users/k77ch7/test.rb:4

My env

jruby 9.0.0.0-SNAPSHOT (2.2.0p0) 2015-02-12 1c1838e Java HotSpot(TM) 64-Bit Server VM 25.5-b02 on 1.8.0_05-b13 +jit [darwin-x86_64]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions