[Bug #20068] Encoding does not matter to empty strings
This commit is contained in:
parent
dd49ee152b
commit
b710f96b5a
2
string.c
2
string.c
@ -3586,7 +3586,7 @@ rb_str_prepend_multi(int argc, VALUE *argv, VALUE str)
|
|||||||
st_index_t
|
st_index_t
|
||||||
rb_str_hash(VALUE str)
|
rb_str_hash(VALUE str)
|
||||||
{
|
{
|
||||||
int e = ENCODING_GET(str);
|
int e = RSTRING_LEN(str) ? ENCODING_GET(str) : 0;
|
||||||
if (e && is_ascii_string(str)) {
|
if (e && is_ascii_string(str)) {
|
||||||
e = 0;
|
e = 0;
|
||||||
}
|
}
|
||||||
|
@ -1344,6 +1344,7 @@ CODE
|
|||||||
assert_not_equal(S("a").hash, S("a\0").hash, bug4104)
|
assert_not_equal(S("a").hash, S("a\0").hash, bug4104)
|
||||||
bug9172 = '[ruby-core:58658] [Bug #9172]'
|
bug9172 = '[ruby-core:58658] [Bug #9172]'
|
||||||
assert_not_equal(S("sub-setter").hash, S("discover").hash, bug9172)
|
assert_not_equal(S("sub-setter").hash, S("discover").hash, bug9172)
|
||||||
|
assert_equal(S("").hash, S("".encode(Encoding::UTF_32BE)).hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_hex
|
def test_hex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user