ruby-changes:7642
From: akr <ko1@a...>
Date: Sat, 6 Sep 2008 05:37:54 +0900 (JST)
Subject: [ruby-changes:7642] Ruby:r19163 (trunk): * transcode.c (output_hex_charref): upcase hexadecimal digits.
akr 2008-09-06 05:37:36 +0900 (Sat, 06 Sep 2008) New Revision: 19163 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19163 Log: * transcode.c (output_hex_charref): upcase hexadecimal digits. Modified files: trunk/ChangeLog trunk/test/ruby/test_econv.rb trunk/transcode.c Index: ChangeLog =================================================================== --- ChangeLog (revision 19162) +++ ChangeLog (revision 19163) @@ -1,3 +1,7 @@ +Sat Sep 6 05:37:08 2008 Tanaka Akira <akr@f...> + + * transcode.c (output_hex_charref): upcase hexadecimal digits. + Sat Sep 6 05:22:29 2008 Tanaka Akira <akr@f...> * include/ruby/encoding.h (ECONV_UNDEF_HEX_CHARREF): defined. Index: test/ruby/test_econv.rb =================================================================== --- test/ruby/test_econv.rb (revision 19162) +++ test/ruby/test_econv.rb (revision 19163) @@ -684,5 +684,13 @@ ec.convert("\u{306f 3041 3044 2665 3002}")) assert_equal("\e(B".force_encoding("ISO-2022-JP"), ec.finish) + + ec = Encoding::Converter.new("EUC-JP", "US-ASCII", Encoding::Converter::UNDEF_HEX_CHARREF) + assert_equal("交換法則: n×m=m×n".force_encoding("ISO-8859-1"), + ec.convert("\xB8\xF2\xB4\xB9\xCB\xA1\xC2\xA7: n\xA1\xDFm=m\xA1\xDFn")) + + ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1", Encoding::Converter::UNDEF_HEX_CHARREF) + assert_equal("交換法則: n\xD7m=m\xD7n".force_encoding("ISO-8859-1"), + ec.convert("\xB8\xF2\xB4\xB9\xCB\xA1\xC2\xA7: n\xA1\xDFm=m\xA1\xDFn")) end end Index: transcode.c =================================================================== --- transcode.c (revision 19162) +++ transcode.c (revision 19163) @@ -1303,7 +1303,7 @@ u += p[1] << 16; u += p[2] << 8; u += p[3]; - snprintf(charef_buf, sizeof(charef_buf), "&#x%x;", u); + snprintf(charef_buf, sizeof(charef_buf), "&#x%X;", u); ret = rb_econv_insert_output(ec, (unsigned char *)charef_buf, strlen(charef_buf), "US-ASCII"); if (ret == -1) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/