summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 20:13:55 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 20:13:55 +0000
commit87664e799f6c4782937ec8154f73e7230e6268a7 (patch)
tree84513771aaafdcf3e9849e5f7aa01bd880d86fba /string.c
parent48247186ba43ccb221c2984ae3d1e12026ad6a5b (diff)
downloadruby-87664e799f6c4782937ec8154f73e7230e6268a7.tar.gz
ruby-87664e799f6c4782937ec8154f73e7230e6268a7.tar.xz
ruby-87664e799f6c4782937ec8154f73e7230e6268a7.zip
* string.c (tr_trans): should associate new encoding if modified.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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;
}