URL encoding in Rails?


#1

Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes


#2

Wes G. 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


#3

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 G. 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


#4

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 G. removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
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


#5

That’s a very vague question.

Simple Answer:
routes.rb