mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* transcode.c (output_hex_charref): upcase hexadecimal digits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c500c37fbc
commit
dc98e2528a
3 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat Sep 6 05:37:08 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (output_hex_charref): upcase hexadecimal digits.
|
||||
|
||||
Sat Sep 6 05:22:29 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* include/ruby/encoding.h (ECONV_UNDEF_HEX_CHARREF): defined.
|
||||
|
|
|
@ -684,5 +684,13 @@ class TestEncodingConverter < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
@ -1303,7 +1303,7 @@ output_hex_charref(rb_econv_t *ec)
|
|||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue