I have a url, “localhost/test/http://myimage.com/” (I’m passing myimage.com, because it’s hosted on another site and I’m accessing it via an api) my question is how do I go about encoding the image portion of the URL? I thought about doing a gsub on the ‘.’ and ‘/’ and then gsubing them back, but I’m wondering if there’s an easier way. Thanks for your help.
I have a url, localhost/test/http://myimage.com/ (I’m passing myimage.com, because it’s hosted on another site
Share
You could use
URI::encode_www_form_component(str)andURI::decode_www_form_componentCheck: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI.html