diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -4871,7 +4871,8 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) if (r == errc) r = trrepl.now; if (c < 256) { trans[c] = r; - if (r > 255) singlebyte = 0; + if (r > 255 || (r > 127 && rb_enc_mbmaxlen(enc) != 1)) + singlebyte = 0; } else { if (!hash) hash = rb_hash_new(); |