CGI::escape does form encoding

The CGI::escape method does encoding for URL-encoded forms,
including the substitution of space with “+”, which is
incorrect for non-form URLs. Is there a method which performs
the correct encoding for URLs, substituting space with “%20”?

···


Clifford Heath

The CGI::escape method does encoding for URL-encoded forms,
including the substitution of space with "+", which is incorrect for
non-form URLs. Is there a method which performs the correct encoding
for URLs, substituting space with "%20"?

:-/ Not that I'm aware of... I ended up writing my own version that
handled this correctly... which, one of these days I should release if
I can decouple it. Maybe try something chump like:

CGI::escape(str).gsub('+', '%20')

That's basically what's happening under the hood. -sc

···

--
Sean Chittenden

Hi,
“Clifford Heath” cjh_nospam@managesoft.com wrote in message
news:3D99472C.CAF3DA04@managesoft.com

The CGI::escape method does encoding for URL-encoded forms,
including the substitution of space with “+”, which is
incorrect for non-form URLs. Is there a method which performs
the correct encoding for URLs, substituting space with “%20”?


Clifford Heath

URI::escape(str) # for ruby 1.6.7 or higher

Park Heesob