diff options
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c index 88f31e157b..f5ec1e756d 100644 --- a/encoding.c +++ b/encoding.c @@ -843,8 +843,8 @@ rb_enc_associate_index(VALUE obj, int idx) } termlen = rb_enc_mbminlen(enc); oldtermlen = rb_enc_mbminlen(rb_enc_from_index(oldidx)); - if (oldtermlen < termlen && RB_TYPE_P(obj, T_STRING)) { - rb_str_fill_terminator(obj, termlen); + if (oldtermlen != termlen && RB_TYPE_P(obj, T_STRING)) { + rb_str_change_terminator_length(obj, oldtermlen, termlen); } enc_set_index(obj, idx); return obj; |