Forum: Ruby on Rails How to encode URLs?

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.
softwareengineer 99 (Guest)
on 2006-01-30 20:32
(Received via mailing list)
How does one encode URLs in ROR?

  Thanks
  Frank
Adam D. (Guest)
on 2006-01-30 20:41
(Received via mailing list)
require 'base64'
Base64.encode64(url)

adam
softwareengineer 99 (Guest)
on 2006-01-30 21:06
(Received via mailing list)
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. <removed_email_address@domain.invalid> wrote:  require 'base64'
Base64.encode64(url)

adam
softwareengineer 99 (Guest)
on 2006-01-30 21:12
(Received via mailing list)
I found the answer.

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

  Thanks
  Frank

softwareengineer 99 <removed_email_address@domain.invalid> 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. <removed_email_address@domain.invalid> wrote:  require 'base64'
Base64.encode64(url)

adam

On 1/30/06, softwareengineer 99  wrote:
>
> _______________________________________________
> Rails mailing   list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails
Adam D. (Guest)
on 2006-01-30 22:46
(Received via mailing list)
try this

require 'uri'
val = URI.escape("my parameter value")

adam
This topic is locked and can not be replied to.