summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 82fa603ada..9079387fac 100644
--- a/string.c
+++ b/string.c
@@ -2560,6 +2560,7 @@ str_substr(VALUE str, long beg, long len, int empty)
str2 = str_new_shared(rb_obj_class(str2), str2);
RSTRING(str2)->as.heap.ptr += ofs;
RSTRING(str2)->as.heap.len = len;
+ ENC_CODERANGE_CLEAR(str2);
}
else {
if (!len && !empty) return Qnil;