aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 515a340adc..e5db1feef6 100644
--- a/string.c
+++ b/string.c
@@ -1500,7 +1500,10 @@ rb_str_modify_expand(VALUE str, long expand)
str_make_independent_expand(str, expand);
}
}
- ENC_CODERANGE_CLEAR(str);
+ if (ENC_CODERANGE(str) == ENC_CODERANGE_BROKEN) {
+ /* Force re-scan later */
+ ENC_CODERANGE_CLEAR(str);
+ }
}
/* As rb_str_modify(), but don't clear coderange */