チケット #542 が更新されました。 (by Takeyuki Fujioka)


この修正のテストを追加
Index: test/cgi/test_cgi_class_method.rb
===================================================================
--- test/cgi/test_cgi_class_method.rb	(リビジョン 0)
+++ test/cgi/test_cgi_class_method.rb	(リビジョン 0)
@@ -0,0 +1,21 @@
+require 'test/unit'
+require 'cgi'
+
+
+class CGIClassMethodTest < Test::Unit::TestCase
+  def test_cgi_class_method_escape
+    assert_equal(CGI::unescape("Hello"),"Hello")
+    assert_equal(CGI::unescape("Hello%21%22%25%26%27%28%29-%3D%5E%7E%7C"),
+      "Hello!\"#$\%&'()-=^~|")
+    unescaped=CGI::unescape("%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF")
+    assert_equal(unescaped,"\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF")
+    if RUBY_VERSION>="1.9.0"
+      assert_equal(CGI::unescape("Hello").encoding,Encoding::US_ASCII)
+      assert_equal(CGI::unescape("Hello%21%22%25%26%27%28%29-%3D%5E%7E%7C").encoding,
+                   Encoding::US_ASCII)
+      assert_equal(unescaped.encoding,Encoding::ASCII_8BIT)
+    end
+  end
+end
+
+

----------------------------------------
http://redmine.ruby-lang.org/issues/show/542

----------------------------------------
http://redmine.ruby-lang.org