mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* encoding.c (rb_enc_compatible): encoding should never fall back
to ASCII-8BIT unless both encodings are ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
968918da16
commit
a648fc802b
4 changed files with 18 additions and 9 deletions
|
@ -397,7 +397,10 @@ rb_enc_compatible(VALUE str1, VALUE str2)
|
|||
if (cr1 == ENC_CODERANGE_7BIT) return rb_enc_from_index(idx2);
|
||||
if (cr2 == ENC_CODERANGE_7BIT) return rb_enc_from_index(idx1);
|
||||
}
|
||||
if (cr1 == ENC_CODERANGE_7BIT) return rb_enc_from_index(0);
|
||||
if (cr2 == ENC_CODERANGE_7BIT) {
|
||||
if (idx1 == 0) return rb_enc_from_index(idx2);
|
||||
if (idx2 == 0) return rb_enc_from_index(idx1);
|
||||
}
|
||||
}
|
||||
if (cr1 == ENC_CODERANGE_7BIT &&
|
||||
rb_enc_asciicompat(enc = rb_enc_from_index(idx2)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue