mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* encoding.c (rb_enc_compatible): If a string is empty and
other's encoding is US-ASCII, returns the empty string's encoding. [ruby-list:46274] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8b83fc2704
commit
e666111955
3 changed files with 10 additions and 2 deletions
|
@ -709,9 +709,9 @@ rb_enc_compatible(VALUE str1, VALUE str2)
|
|||
enc2 = rb_enc_from_index(idx2);
|
||||
|
||||
if (TYPE(str2) == T_STRING && RSTRING_LEN(str2) == 0)
|
||||
return enc1;
|
||||
return (idx1 == ENCINDEX_US_ASCII && rb_enc_asciicompat(enc2)) ? enc2 : enc1;
|
||||
if (TYPE(str1) == T_STRING && RSTRING_LEN(str1) == 0)
|
||||
return enc2;
|
||||
return (idx2 == ENCINDEX_US_ASCII && rb_enc_asciicompat(enc1)) ? enc1 : enc2;
|
||||
if (!rb_enc_asciicompat(enc1) || !rb_enc_asciicompat(enc2)) {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue