Backo
Backo

Reputation: 18871

How to convert a string so to correctly pass that in an URL?

I am using Rails 3.1.1 and I would like to convert a string so to correctly pass that in an URL. For example to convert from something like some_text to%convert&èì to some else...

What are Pros, Cons and Advices?

Upvotes: 1

Views: 2688

Answers (1)

Alpha Beta Charlie
Alpha Beta Charlie

Reputation: 841

I think you should try with URI.escape

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI/Escape.html

Don't forget to require 'open-uri'

Upvotes: 4

Related Questions