aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/uri.rb
diff options
context:
space:
mode:
authormoro <moronatural@gmail.com>2009-02-15 19:34:04 +0900
committerJeremy Kemper <jeremy@bitsweat.net>2009-02-20 18:18:39 -0800
commit3b3dbd797397fe692fa50bdb46a0db06b82bf848 (patch)
tree3df7a5dbb4ed5bd4329883b5ec4a8a38605c8b63 /activesupport/lib/active_support/core_ext/uri.rb
parent8c5cc66a831aadb159f3daaffa4208064c30af0e (diff)
downloadrails-3b3dbd797397fe692fa50bdb46a0db06b82bf848.tar.gz
rails-3b3dbd797397fe692fa50bdb46a0db06b82bf848.tar.bz2
rails-3b3dbd797397fe692fa50bdb46a0db06b82bf848.zip
Ruby 1.9.1p0's URI.decode() bug fix
backport to fix Ruby 1.9.1p0 bug on [ruby-dev:38005]. Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/uri.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/uri.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb
new file mode 100644
index 0000000000..26b050bf2b
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/uri.rb
@@ -0,0 +1,13 @@
+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
+ end
+ end
+end
+