aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/uri.rb
blob: 4c8ebbee5805e1132d508ad8d9a135cd7f2c371a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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