aboutsummaryrefslogtreecommitdiffstats
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 e24ca623dc..2bec884bef 100644
--- a/string.c
+++ b/string.c
@@ -425,6 +425,7 @@ rb_str_new4(VALUE orig)
RSTRING(str)->as.heap.ptr += ofs;
RSTRING(str)->as.heap.len -= ofs;
}
+ rb_enc_copy(str, orig);
OBJ_INFECT(str, orig);
}
else if (STR_EMBED_P(orig)) {