Passing complete stops (periods) and slashes in a GET request?

I created a form that submits values ​​to Wufoo as a GET request in the URL. I can't get it to work if any of the values ​​(in the text box) contains a line break or a slash. Is there a way to encode them in a URL?

This is done in Rails.

+4
source share
2 answers

I thought Rails would do it for you. But if you need to do this manually, you can use CGI :: escape, for example.

> require 'cgi' ... > CGI.escape("hello%there\nworld") => "hello%25there%0Aworld" 

EDIT: Actually, CGI doesn't seem to be evading the point. The URI can be used instead, it takes an additional parameter that allows you to specify additional characters that you want to escape:

 URI.escape("hello.there%world", ".") 
+2
source

All Articles