diff --git a/string.c b/string.c index 6fd5866336..f556cdf180 100644 --- a/string.c +++ b/string.c @@ -2473,6 +2473,7 @@ rb_str_modify_expand(VALUE str, long expand) else if (expand > 0) { RESIZE_CAPA_TERM(str, len + expand, termlen); } + ENC_CODERANGE_CLEAR(str); } /* As rb_str_modify(), but don't clear coderange */