diff options
Diffstat (limited to 'lib/cgi')
-rw-r--r-- | lib/cgi/util.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb index 98ff4be0ca..3fc462df27 100644 --- a/lib/cgi/util.rb +++ b/lib/cgi/util.rb @@ -15,7 +15,7 @@ module CGI::Util # string = CGI::unescape("%27Stop%21%27+said+Fred") # # => "'Stop!' said Fred" def unescape(string,encoding=@@accept_charset) - str=string.tr('+', ' ').force_encoding(Encoding::ASCII_8BIT).gsub(/((?:%[0-9a-fA-F]{2})+)/) do + str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do [$1.delete('%')].pack('H*') end.force_encoding(encoding) str.valid_encoding? ? str : str.force_encoding(string.encoding) |