[前][次][番号順一覧][スレッド一覧]

ruby-changes:28129

From: xibbar <ko1@a...>
Date: Mon, 8 Apr 2013 13:06:48 +0900 (JST)
Subject: [ruby-changes:28129] xibbar:r40181 (trunk): * lib/cgi/util.rb (CGI::unescapeHTML): fix Hexadecimal numeric character.

xibbar	2013-04-08 13:06:39 +0900 (Mon, 08 Apr 2013)

  New Revision: 40181

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40181

  Log:
    * lib/cgi/util.rb (CGI::unescapeHTML): fix Hexadecimal numeric character.
      [Bug #8183]

  Modified files:
    trunk/lib/cgi/util.rb
    trunk/test/cgi/test_cgi_util.rb

Index: lib/cgi/util.rb
===================================================================
--- lib/cgi/util.rb	(revision 40180)
+++ lib/cgi/util.rb	(revision 40181)
@@ -55,7 +55,7 @@ class CGI https://github.com/ruby/ruby/blob/trunk/lib/cgi/util.rb#L55
       end
     end
     asciicompat = Encoding.compatible?(string, "a")
-    string.gsub(/&(apos|amp|quot|gt|lt|\#[0-9]+|\#x[0-9A-Fa-f]+);/) do
+    string.gsub(/&(apos|amp|quot|gt|lt|\#[0-9]+|\#[xX][0-9A-Fa-f]+);/) do
       match = $1.dup
       case match
       when 'apos'                then "'"
Index: test/cgi/test_cgi_util.rb
===================================================================
--- test/cgi/test_cgi_util.rb	(revision 40180)
+++ test/cgi/test_cgi_util.rb	(revision 40181)
@@ -61,4 +61,8 @@ class CGIUtilTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/cgi/test_cgi_util.rb#L61
     assert_equal(CGI::unescapeHTML("&#39;&amp;&quot;&gt;&lt;"),"'&\"><")
   end
 
+  def test_cgi_unescapeHTML_uppercasecharacter
+    assert_equal(CGI::unescapeHTML("&#x3042;&#x3044;&#X3046;"),"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86")
+  end
+
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]