diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 11:59:57 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 11:59:57 +0000 |
commit | ecf097285bc87ba5852ac80f3eca6e664383d9a3 (patch) | |
tree | 8ab44c2ad3410f114ff536395d442b68cdca4dec /transcode.c | |
parent | 050ea22a3832b7187b8450c77452588a97b74c89 (diff) | |
download | ruby-ecf097285bc87ba5852ac80f3eca6e664383d9a3.tar.gz ruby-ecf097285bc87ba5852ac80f3eca6e664383d9a3.tar.xz ruby-ecf097285bc87ba5852ac80f3eca6e664383d9a3.zip |
* transcode.c (str_transcode0): set encoding when String#encode was
given explicit but the same destination and source encoding.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r-- | transcode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/transcode.c b/transcode.c index e5538a087..7cdda7b7b 100644 --- a/transcode.c +++ b/transcode.c @@ -2455,7 +2455,7 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts) ECONV_XML_ATTR_CONTENT_DECORATOR| ECONV_XML_ATTR_QUOTE_DECORATOR)) == 0) { if (senc && senc == denc) { - return -1; + return NIL_P(arg2) ? -1 : dencidx; } if (senc && denc && rb_enc_asciicompat(senc) && rb_enc_asciicompat(denc)) { if (ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) { @@ -2463,7 +2463,7 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts) } } if (encoding_equal(sname, dname)) { - return -1; + return NIL_P(arg2) ? -1 : dencidx; } } else { |