URI.unescape fix removes the old unescape method

This commit is contained in:
Jeremy Kemper
2009-02-20 18:25:02 -08:00
parent 3b3dbd7973
commit 98ddc64782

View File

@@ -1,13 +1,10 @@
require 'uri'
module ActiveSupport
if RUBY_VERSION == "1.9.1" && defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL == 0
::URI::Parser.class_eval do
def unescape(str, escaped = @regexp[:ESCAPED])
enc = (str.encoding == Encoding::US_ASCII) ? Encoding::UTF_8 : str.encoding
str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc)
end
if RUBY_VERSION == "1.9.1" && defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL == 0
require 'uri'
URI::Parser.class_eval do
remove_method :unescape
def unescape(str, escaped = @regexp[:ESCAPED])
enc = (str.encoding == Encoding::US_ASCII) ? Encoding::UTF_8 : str.encoding
str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc)
end
end
end