diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-08 09:38:01 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-08 09:38:01 +0000 |
commit | 6db869c1019948a878b2735ca205888af2e07ecb (patch) | |
tree | fbec34631a04841232c759fb83bba6b4cf6cd529 /lib/uri/rfc2396_parser.rb | |
parent | 0a2fb188e397d69a2b68d98b797fe0b68d4d11ee (diff) | |
download | ruby-6db869c1019948a878b2735ca205888af2e07ecb.tar.gz |
fix error if the input is mixed Unicode and percent-escapes
Reported by kivikakk (Ashe Connor) with tests and doc fix
Patch based on mame and fix by naruse
[Bug #14586]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri/rfc2396_parser.rb')
-rw-r--r-- | lib/uri/rfc2396_parser.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index b9e7b2b26e..a6e5df91f9 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -315,13 +315,13 @@ module URI # # :call-seq: # unescape( str ) - # unescape( str, unsafe ) + # unescape( str, escaped ) # # == Args # # +str+:: # String to remove escapes from - # +unsafe+:: + # +escaped+:: # Regexp to apply. Defaults to self.regexp[:ESCAPED] # # == Description @@ -329,7 +329,7 @@ module URI # Removes escapes from +str+ # def unescape(str, escaped = @regexp[:ESCAPED]) - str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding) + str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(str.encoding) } end @@to_s = Kernel.instance_method(:to_s) |