Skip to content

Commit

Permalink
URI.unescape fix removes the old unescape method
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Feb 21, 2009
1 parent 3b3dbd7 commit 98ddc64
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions activesupport/lib/active_support/core_ext/uri.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 98ddc64

Please sign in to comment.