Method: URI.cgi_escape
- Defined in:
- lib/standard/facets/uri.rb
.cgi_escape(string) ⇒ Object
CGI escape
TODO: How does this compare to URI.escape?
83 84 85 86 87 |
# File 'lib/standard/facets/uri.rb', line 83 def cgi_escape(string) string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do '%' + $1.unpack('H2' * $1.size).join('%').upcase end.tr(' ', '+') end |