lib/em-http/http_encoding.rb in em-http-request-1.0.0 vs lib/em-http/http_encoding.rb in em-http-request-1.0.1
- old
+ new
@@ -5,20 +5,20 @@
def escape(s)
if defined?(EscapeUtils)
EscapeUtils.escape_url(s.to_s)
else
- s.to_s.gsub(/([^a-zA-Z0-9_.-]+)/n) {
+ s.to_s.gsub(/([^a-zA-Z0-9_.-]+)/) {
'%'+$1.unpack('H2'*bytesize($1)).join('%').upcase
}
end
end
def unescape(s)
if defined?(EscapeUtils)
EscapeUtils.unescape_url(s.to_s)
else
- s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) {
+ s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/) {
[$1.delete('%')].pack('H*')
}
end
end