Skip to content

Commit

Permalink
Use URI::RFC2396_PARSER explicitly in URI
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Aug 8, 2024
1 parent 9997c1a commit 898b889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/uri/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def self.build2(args)
if args.kind_of?(Array)
return self.build(args.collect{|x|
if x.is_a?(String)
DEFAULT_PARSER.escape(x)
URI::RFC2396_PARSER.escape(x)
else
x
end
Expand All @@ -91,7 +91,7 @@ def self.build2(args)
tmp = {}
args.each do |key, value|
tmp[key] = if value
DEFAULT_PARSER.escape(value)
URI::RFC2396_PARSER.escape(value)
else
value
end
Expand Down
4 changes: 2 additions & 2 deletions test/uri/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def test_raise_bad_uri_for_integer
end
end

def test_unescape
p1 = URI::Parser.new
def test_rfc2822_unescape
p1 = URI::RFC2396_Parser.new
assert_equal("\xe3\x83\x90", p1.unescape("\xe3\x83\x90"))
assert_equal("\xe3\x83\x90", p1.unescape('%e3%83%90'))
assert_equal("\u3042", p1.unescape('%e3%81%82'.force_encoding(Encoding::US_ASCII)))
Expand Down

0 comments on commit 898b889

Please sign in to comment.