What is the Ruby/Rails equivalent of Python's urllib.quote_plus?
Basically url escapes a string e开发者_StackOverflow中文版xcept uses '+' instead of '%20' for spaces.
CGI::escape
does just that:
irb(main):003:0> require 'cgi'
=> true
irb(main):004:0> CGI::escape("foo and/or bar")
=> "foo+and%2For+bar"
精彩评论