1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (rb_enc_compatible): ASCII encoding is compatible with

ASCII-compatible encoding, even for non-string objects.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-29 08:18:36 +00:00
parent 2e064c694c
commit 3dacfd3fe4
3 changed files with 13 additions and 3 deletions

View file

@ -360,6 +360,11 @@ rb_enc_compatible(VALUE str1, VALUE str2)
return rb_enc_from_index(idx1);
}
if (idx1 == 0 && rb_enc_asciicompat(enc = rb_enc_from_index(idx2)))
return enc;
if (idx2 == 0 && rb_enc_asciicompat(enc = rb_enc_from_index(idx1)))
return enc;
if (BUILTIN_TYPE(str1) != T_STRING) {
VALUE tmp = str1;
str1 = str2;