Method: Spider::HTTP.urlencode
- Defined in:
- lib/spiderfw/http/http.rb
.urlencode(s) ⇒ Object
Parameters
- s<String>
-
String to URL escape.
returns
- String
-
The escaped string.
– from Merb
142 143 144 145 146 |
# File 'lib/spiderfw/http/http.rb', line 142 def self.urlencode(s) s.to_s.gsub(/([^a-zA-Z0-9_.-]+)/n) { '%'+$1.unpack('H2'*$1.size).join('%').upcase }.tr(' ', '+') end |