-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lib/cgi/util.rb (CGI::unescape): support encoding option.
* lib/cgi/cookie.rb (CGI::Cookie.parse): fix for the encoded value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
- Loading branch information
xibbar
committed
Jul 30, 2009
1 parent
3ca25b5
commit 1976ef3
Showing
6 changed files
with
57 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
Thu Jul 29 14:25:14 2009 Takeyuki FUJIOKA <[email protected]> | ||
|
||
* lib/cgi/util.rb (CGI::unescape): support encoding option. | ||
|
||
* lib/cgi/cookie.rb (CGI::Cookie.parse): fix for the encoded value. | ||
|
||
Wed Jul 29 08:08:07 2009 NARUSE, Yui <[email protected]> | ||
|
||
* parse.y (regexp): regexp literal at the top of dstr is still needed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'test/unit' | ||
require 'cgi' | ||
require 'stringio' | ||
|
||
|
||
class CGIUtilTest < Test::Unit::TestCase | ||
|
||
|
||
def setup | ||
ENV['REQUEST_METHOD'] = 'GET' | ||
@str1="&<>\" \xE3\x82\x86\xE3\x82\x93\xE3\x82\x86\xE3\x82\x93" | ||
@str1.force_encoding("UTF-8") if RUBY_VERSION>="1.9" | ||
end | ||
|
||
def teardown | ||
%W[REQUEST_METHOD SCRIPT_NAME].each do |name| | ||
ENV.delete(name) | ||
end | ||
end | ||
|
||
|
||
def test_cgi_escape | ||
assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93', CGI::escape(@str1)) | ||
assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'.ascii_only?, CGI::escape(@str1).ascii_only?) if RUBY_VERSION>="1.9" | ||
end | ||
|
||
def test_cgi_unescape | ||
assert_equal(@str1, CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93')) | ||
assert_equal(@str1.encoding, CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93').encoding) if RUBY_VERSION>="1.9" | ||
end | ||
|
||
end |