Skip to main content
8 events
when toggle format what by license comment
Apr 20, 2014 at 19:44 vote accept Michael Durrant
Apr 17, 2014 at 14:02 comment added Flambino @MichaelDurrant Ah, ok. Well, it's totally up you. I'd probably end up sticking with CGI.escape as well, since it does what you want by default. As mentioned, you can use URI.escape too, if you provide the 2nd argument, but it's more work.
Apr 17, 2014 at 13:55 comment added Michael Durrant I should have been more specific, I need it to end up with characters like ":" as %3A as I am trying to just replicate what a current param is in our system.
Apr 17, 2014 at 13:43 comment added Flambino @MichaelDurrant Gotcha. I am curious, though, how these URLs should end up looking; there shouldn't really be anything that needs escaping, really. Also, you can pass a regexp or string to URI.escape (see docs), telling it what should be forcibly escaped. With your input, URI.escape(string, ":") will produce the exact same output as CGI.escape(string)
Apr 17, 2014 at 13:31 comment added Michael Durrant Looks good. btw I had tried using the URI.escape but it didn't code things correctly for me (or at all) so I switched to CGI.escape at the suggestion of a colleague
Apr 17, 2014 at 11:33 history edited Flambino CC BY-SA 3.0
added 2 characters in body
Apr 17, 2014 at 11:25 history edited Flambino CC BY-SA 3.0
added 2 characters in body
Apr 17, 2014 at 11:16 history answered Flambino CC BY-SA 3.0