Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: UTF-8
- class String
- # url encoding special characters
- def url_enc_signs
- encode_signs = {'+' => "%2B", '=' => "%3D", '?' => '%3F', '@' => '%40',
- '$' => '%24', '&' => '%26', ',' => '%2C', '/' => '%2F', ':' => '%3A',
- ';' => '%3B', '?' => '%3F'}
- string_t = self
- encode_signs.keys.each do |key|
- string_t.gsub!(key, encode_signs[key])
- end
- return string_t
- end
- end
Add Comment
Please, Sign In to add comment