* transcode.c (str_transcode0): check ECONV_HTML_TEXT_ENCODER and

ECONV_HTML_ATTR_ENCODER.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-06 09:48:32 +00:00
parent 987ec6b787
commit f10af82d25
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sat Sep 6 18:47:40 2008 Tanaka Akira <akr@fsij.org>
* transcode.c (str_transcode0): check ECONV_HTML_TEXT_ENCODER and
ECONV_HTML_ATTR_ENCODER.
Sat Sep 6 18:38:47 2008 Tanaka Akira <akr@fsij.org>
* transcode.c (allocate_converted_string): fix overflow condition.

View File

@ -774,5 +774,8 @@ class TestEncodingConverter < Test::Unit::TestCase
"&\u3046\u2665&\"'".encode("iso-2022-jp", html: :text))
assert_equal("\"&amp;\e$B$&\e(B&#x2661;&amp;&quot;'\"".force_encoding("iso-2022-jp"),
"&\u3046\u2661&\"'".encode("iso-2022-jp", html: :attr))
assert_equal("&amp;\u3046\u2661&amp;\"'".force_encoding("utf-8"),
"&\u3046\u2661&\"'".encode("utf-8", html: :text))
end
end

View File

@ -2295,7 +2295,9 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts)
if ((ecflags & (ECONV_UNIVERSAL_NEWLINE_DECODER|
ECONV_CRLF_NEWLINE_ENCODER|
ECONV_CR_NEWLINE_ENCODER)) == 0) {
ECONV_CR_NEWLINE_ENCODER|
ECONV_HTML_TEXT_ENCODER|
ECONV_HTML_ATTR_ENCODER)) == 0) {
if (senc && senc == denc) {
return -1;
}