How to encode URLs?

How does one encode URLs in ROR?

Thanks
Frank

require ‘base64’
Base64.encode64(url)

adam

Thank you Adam for your reply.

If I am encoding a string “l o p o”, then the Base64.encode64 will
convert it to bCBvIHAgbyA=.

I am looking for a function similar to PHP’s urlencode which will
convert “l o p o” to “l+o+p+o” or “l%20o%20p%20o”

Thanks
Frank

Adam D. [email protected] wrote: require ‘base64’
Base64.encode64(url)

adam

try this

require ‘uri’
val = URI.escape(“my parameter value”)

adam

I found the answer.

Use <%= u("l o p o ") %>

Thanks
Frank

softwareengineer 99 [email protected] wrote: Thank you
Adam for your reply.

If I am encoding a string “l o p o”, then the Base64.encode64 will
convert it to bCBvIHAgbyA=.

I am looking for a function similar to PHP’s urlencode which will
convert “l o p o” to “l+o+p+o” or “l%20o%20p%20o”

Thanks
Frank

Adam D. [email protected] wrote: require ‘base64’
Base64.encode64(url)

adam

On 1/30/06, softwareengineer 99 wrote:


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more
on new and used cars._______________________________________________
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs