From 19cf57f21ca8e838c78caa2d19d9da36569cc929 Mon Sep 17 00:00:00 2001 From: matz Date: Sun, 23 Dec 2007 20:13:55 +0000 Subject: * string.c (tr_trans): should associate new encoding if modified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 271960d730..60eadbd1db 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; } -- cgit v1.2.3