How to encode URLs?


#1

How does one encode URLs in ROR?

Thanks
Frank


#2

require ‘base64’
Base64.encode64(url)

adam


#3

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


#4

try this

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

adam


#5

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