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.