From 1168cf73055573685f2be3e1234dec321c98d93f Mon Sep 17 00:00:00 2001 From: erwanlr Date: Mon, 25 Mar 2013 22:08:14 +0100 Subject: [PATCH] Fixes, once and for all the deprecated usage of URI.escape & URI.encode --- lib/common/hacks.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/common/hacks.rb b/lib/common/hacks.rb index 7ec15ed1..9886be77 100644 --- a/lib/common/hacks.rb +++ b/lib/common/hacks.rb @@ -4,9 +4,13 @@ # See http://rosettacode.org/wiki/URL_encoding#Ruby and http://www.ruby-forum.com/topic/207489 if RUBY_VERSION >= '1.9.2' module URI - def self.escape(str) - URI.encode_www_form_component(str).gsub('+', '%20') + extend self + + def escape(str) + URI::Parser.new.escape(str) end + alias :encode :escape + end end