* transcode.c (str_transcode0): set encoding when String#encode was

given explicit but the same destination and source encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-12-25 11:59:57 +00:00
Родитель b0480260e2
Коммит 20f5c2a3ba
3 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Dec 25 20:57:01 2008 NARUSE, Yui <naruse@ruby-lang.org>
* transcode.c (str_transcode0): set encoding when String#encode was
given explicit but the same destination and source encoding.
Thu Dec 25 20:01:50 2008 Tanaka Akira <akr@fsij.org>
* io.c (rb_io_s_pipe): unused variable removed.

Просмотреть файл

@ -72,6 +72,7 @@ class TestTranscode < Test::Unit::TestCase
"\xBE\xD6\xC0\xCE\xB1\xB8\xC7\xD4\x20\xDA\xD3\xC1\xF6\xC0\xCE", 'euc-kr') # 애인구함 朴지인
check_both_ways("\uC544\uD58F\uD58F\u0020\uB620\uBC29\uD6BD\uB2D8\u0020\uC0AC\uB791\uD716",
"\xBE\xC6\xC1\x64\xC1\x64\x20\x8C\x63\xB9\xE6\xC4\x4F\xB4\xD4\x20\xBB\xE7\xB6\xFB\xC5\x42", 'cp949') # 아햏햏 똠방횽님 사랑휖
assert_equal(Encoding::ISO_8859_1, "D\xFCrst".force_encoding('iso-8859-2').encode('iso-8859-1', 'iso-8859-1').encoding)
end
def test_twostep

Просмотреть файл

@ -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 {