Fix Hash#inspect of Symbol keys with non-ASCII encoding#9410
Conversation
d3bd677 to
2009c6a
Compare
isSimpleName classified names via a Java String built by RubyEncoding.decodeRaw (byte-as-Latin-1), misclassifying multibyte characters. Use the existing isSymbolName(String) when ASCII and use the encoding-aware SymbolNameType when the encoding is not ASCII. Re-enables TestHash#test_inspect; also drops a stale no-op exclude in TestHashOnly (no test_inspect method exists in that class).
2009c6a to
823dce0
Compare
|
Nice, thank you! Will wait to see how the tests shake out. |
|
Thanks! All the tests pass. The challenging part was the differences between So I guess a follow up PR would be to look more into SymbolNameType possibly miscategorizing symbols. |
|
Those methods are intended to mimic the same symbol classification logic in cruby but they have never been exactly the same and have diverged frequently. Every so often I run into a case where we need them to work correctly for some optimization or error check. This is a good step in the right direction. |
isSymbolName was classifying names via a Java String built by RubyEncoding.decodeRaw (byte-as-Latin-1), losing multi-byte character grouping. Use the encoding-aware SymbolNameType when the string is not ASCII instead.
Re-enables TestHash#test_inspect; also drops a stale no-op exclude in TestHashOnly (no test_inspect method exists in that class).