Simple question: How does one do URL encoding in Ruby/Rails? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
That''s a very vague question. Simple Answer: routes.rb On Mon, 2006-05-01 at 17:05 +0200, Wes Gamble wrote:> Simple question: > > How does one do URL encoding in Ruby/Rails? > > Thanks, > Wes >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060501/b927570d/attachment.html
Try: CGI::escape(''scott walter'') You may need to require "CGI" scott. ---------------------------------------------------------------------------------------------------- What''s an Intel chip doing in a Mac? A whole lor more that it''s ever done in a PC. My Digital Life - http://scottwalter.com/blog Pro:Blog - http://scottwalter.com/problog ----- Original Message ---- From: Wes Gamble <weyus@att.net> To: rails@lists.rubyonrails.org Sent: Monday, May 1, 2006 10:05:08 AM Subject: [Rails] URL encoding in Rails? Simple question: How does one do URL encoding in Ruby/Rails? Thanks, Wes -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060501/7184ee89/attachment.html
Wes Gamble wrote:> Simple question: > > How does one do URL encoding in Ruby/Rails? > > Thanks, > WesCheck out CGI.escape(). CGI is part of the Ruby standard library. Typically you''ll want to pass in just a querystring parameter value (not the entire URI). --Ed -- Posted via http://www.ruby-forum.com/.
And CGI.escape_skipping_slashes added in Rails'' Active Supprt. It''s good for a pathname, but not for a URL with hostname. DD Ed Lau wrote:> Wes Gamble wrote: >> Simple question: >> >> How does one do URL encoding in Ruby/Rails? >> >> Thanks, >> Wes > > Check out CGI.escape(). CGI is part of the Ruby standard library. > Typically you''ll want to pass in just a querystring parameter value (not > the entire URI). > > --Ed-- Posted via http://www.ruby-forum.com/.