From af2228a08d38e4ed748f5552c880ef97374364b0 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 18 Apr 2014 08:00:04 +0000 Subject: [PATCH] string.c: don't clear coderange at expanding * string.c (rb_str_modify_expand): like as str_modify_keep_cr, don't clear coderange unless broken. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 */