summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/string.c b/string.c
index 271960d73..60eadbd1d 100644
--- a/string.c
+++ b/string.c
@@ -3654,8 +3654,11 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
STR_SET_NOEMBED(str);
RSTRING(str)->as.heap.aux.capa = max;
}
-
- if (modify) return str;
+
+ if (modify) {
+ rb_enc_associate(str, enc);
+ return str;
+ }
return Qnil;
}