[ruby/uri] Use URI::RFC2396_PARSER explicitly in URI

https://github.com/ruby/uri/commit/898b889811
This commit is contained in:
Hiroshi SHIBATA 2024-08-08 11:06:03 +09:00 committed by git
parent c3becc3ba6
commit 68ebd56a76
2 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,7 @@ module URI
if args.kind_of?(Array) if args.kind_of?(Array)
return self.build(args.collect{|x| return self.build(args.collect{|x|
if x.is_a?(String) if x.is_a?(String)
DEFAULT_PARSER.escape(x) URI::RFC2396_PARSER.escape(x)
else else
x x
end end
@ -91,7 +91,7 @@ module URI
tmp = {} tmp = {}
args.each do |key, value| args.each do |key, value|
tmp[key] = if value tmp[key] = if value
DEFAULT_PARSER.escape(value) URI::RFC2396_PARSER.escape(value)
else else
value value
end end

View File

@ -69,8 +69,8 @@ class URI::TestParser < Test::Unit::TestCase
end end
end end
def test_unescape def test_rfc2822_unescape
p1 = URI::Parser.new p1 = URI::RFC2396_Parser.new
assert_equal("\xe3\x83\x90", p1.unescape("\xe3\x83\x90")) assert_equal("\xe3\x83\x90", p1.unescape("\xe3\x83\x90"))
assert_equal("\xe3\x83\x90", p1.unescape('%e3%83%90')) assert_equal("\xe3\x83\x90", p1.unescape('%e3%83%90'))
assert_equal("\u3042", p1.unescape('%e3%81%82'.force_encoding(Encoding::US_ASCII))) assert_equal("\u3042", p1.unescape('%e3%81%82'.force_encoding(Encoding::US_ASCII)))