2010-03-28 86 views

回答

3

CGI::escape做到了這一點:

irb(main):003:0> require 'cgi' 
=> true 
irb(main):004:0> CGI::escape("foo and/or bar") 
=> "foo+and%2For+bar" 
+0

BTW,CGI ::逃避不允許指定組中不字符轉義,像urllib.quote_plus作用:HTTP://docs.python。組織/ 2 /庫/ urllib.html – aqn 2014-01-08 20:41:42