develop with

Url encode strings

Using standard ruby features to encode strings

Url encoding is quite easy in ruby there are a couple of ways depending on your need. Here are a few techniques:

require 'open-uri'
URI::encode(str)

and

require 'open-uri'
URI.encode_www_form_component(str)

For more details on the uri class see Ruby Docs URI.

comments powered by Disqus

Want to see a topic covered? create a suggestion

Get more developer references and books in the developwith store.