diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1926,6 +1926,7 @@ rb_str_comparable(VALUE str1, VALUE str2) { int idx1, idx2; int rc1, rc2; + int a8; if (RSTRING_LEN(str1) == 0) return Qtrue; if (RSTRING_LEN(str2) == 0) return Qtrue; @@ -1943,6 +1944,8 @@ rb_str_comparable(VALUE str1, VALUE str2) if (rb_enc_asciicompat(rb_enc_from_index(idx1))) return Qtrue; } + a8 = rb_ascii8bit_encindex(); + if (idx1 == a8 || idx2 == a8) return Qtrue; return Qfalse; } @@ -1956,7 +1959,7 @@ rb_str_cmp(VALUE str1, VALUE str2) retval = memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len); if (retval == 0) { if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) { - if (!rb_enc_compatible(str1, str2)) { + if (!rb_str_comparable(str1, str2)) { if (ENCODING_GET(str1) - ENCODING_GET(str2) > 0) return 1; return -1; |