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

Tue Aug 14 11:55:37 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>

* lib/cgi/util.rb (CGI::escapeHTML): &apos; is not recommended. [Bug #6850]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2012-08-14 03:03:42 +00:00
parent 7fc28975bc
commit 745ada8649
3 changed files with 3 additions and 3 deletions

View file

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

View file

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

View file

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