summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 05:49:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 05:49:34 +0000
commit65fcaf4113e5e9855e98c3f483f34e1bfe077203 (patch)
tree6c54410e8d9e9829dde7014dc58faea2d5248990 /string.c
parentf59caa2950d454f651438cccff6298c4e13dc354 (diff)
* string.c (rb_str_conv_enc_opts): default to original encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 f2694a8947..1a0b432c0e 100644
--- a/string.c
+++ b/string.c
@@ -483,6 +483,7 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
unsigned char *dp;
if (!to) return str;
+ if (!from) from = rb_enc_get(str);
if (from == to) return str;
if ((rb_enc_asciicompat(to) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) ||
to == rb_ascii8bit_encoding()) {