开发者

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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜