Actions
Bug #8866
closedfrozen string literal("foo"f ) can ignore source encoding after r42843.
Description
Hello,
After r42843, frozen string literal can have encoding different from script encoding.
example:
usascii.rb:
coding: us-ascii¶
def usascii
"foo"f
end
utf8.rb:
coding: utf-8¶
def utf8
"foo"f
end
$ ruby -r./usascii -r./utf8 -e 'p [usascii.object_id == utf8.object_id, usascii.encoding, utf8.encoding]'
[true, #Encoding:US-ASCII, #Encoding:US-ASCII]
$ ruby -r./utf8 -r./usascii -e 'p [usascii.object_id == utf8.object_id, usascii.encoding, utf8.encoding]'
[true, #Encoding:UTF-8, #Encoding:UTF-8]
It is because fstring_hash_type use rb_str_cmd for compare functions.
rb_str_cmd() treat strings contains only ascii characters with ascii compatible encodings as same strings.
Regards.
Actions
Like0
Like0