Forum: Ruby on Rails URL encoding in Rails?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-01 17:05
Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes
311e09a61c1d72c25c99d8f6bb580d28?d=identicon&s=25 Ed Lau (edlau)
on 2006-05-02 02:09
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
F641ba2e0fc906fb77d74b52cf59d187?d=identicon&s=25 Doug Dupory (doug)
on 2006-05-02 20:26
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
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-05-03 18:57
(Received via mailing list)
That's a very vague question.

Simple Answer:
routes.rb
1b275ea705cc1671f13105d29684cbec?d=identicon&s=25 Scott Walter (sfwalter)
on 2006-05-03 18:57
(Received via mailing list)
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
This topic is locked and can not be replied to.