1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi/util.rb (CGI.escapeHTML): use '

[ruby-core:47221] [Bug #6861]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-08-21 22:30:47 +00:00
parent b0837c440e
commit bbb6b5e84e
4 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Wed Aug 22 07:27:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
* lib/cgi/util.rb (CGI.escapeHTML): use &#39;
[ruby-core:47221] [Bug #6861]
Tue Aug 21 21:59:22 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* lib/observer.rb: fix typo. https://github.com/ruby/ruby/pull/162 by

View file

@ -22,7 +22,7 @@ class CGI
# The set of special characters and their escaped values
TABLE_FOR_ESCAPE_HTML__ = {
"'" => '&#x27;',
"'" => '&#39;',
'&' => '&amp;',
'"' => '&quot;',
'<' => '&lt;',

View file

@ -54,11 +54,11 @@ class CGIUtilTest < Test::Unit::TestCase
end
def test_cgi_escapeHTML
assert_equal(CGI::escapeHTML("'&\"><"),"&#x27;&amp;&quot;&gt;&lt;")
assert_equal(CGI::escapeHTML("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
end
def test_cgi_unescapeHTML
assert_equal(CGI::unescapeHTML("&apos;&amp;&quot;&gt;&lt;"),"'&\"><")
assert_equal(CGI::unescapeHTML("&#39;&amp;&quot;&gt;&lt;"),"'&\"><")
end
end

View file

@ -39,8 +39,7 @@ class TestERB < Test::Unit::TestCase
end
def test_html_escape
# TODO: &apos; should be changed to &#x27;
assert_equal(" !&quot;\#$%&amp;&#x27;()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
assert_equal(" !&quot;\#$%&amp;&#39;()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
ERB::Util.html_escape(" !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"))
assert_equal("", ERB::Util.html_escape(""))