From ecf097285bc87ba5852ac80f3eca6e664383d9a3 Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 25 Dec 2008 11:59:57 +0000 Subject: * 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 --- transcode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'transcode.c') 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 { -- cgit