You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Rodent of Unusual Size <Ke...@Golux.Com> on 2002/07/17 15:59:16 UTC

No function for x-www-form-urlencoded?

Something just came up on the #apache channel at irc.openprojects.net.
Someone has a need to be able to encode data as though they were
entered in an HTML form field.  E.g., if someone put "a & b = c"
into a form field, it should be encoded into "a%20%26%20b%20%3D%20c".

There doesn't appear to be anything like this in the httpd API, nor
does it seem to be in apreq.  Have I missed something, or shall I
submit a patch to add this?  It seems like a reasonable client-library
function..
-- 
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"

Re: No function for x-www-form-urlencoded?

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Rodent of Unusual Size <Ke...@Golux.Com> writes:

> Something just came up on the #apache channel at irc.openprojects.net.
> Someone has a need to be able to encode data as though they were
> entered in an HTML form field.  E.g., if someone put "a & b = c"
> into a form field, it should be encoded into "a%20%26%20b%20%3D%20c".
> 
> There doesn't appear to be anything like this in the httpd API, nor
> does it seem to be in apreq.  Have I missed something, or shall I
> submit a patch to add this?  It seems like a reasonable client-library
> function..

apreq-2 has an apreq_escape() function; it url-encodes anything that
isn't alphanumeric.  httpd has ap_os_escape_path(), but it leaves too
many tokens (i.e. '&' and '=' here) unescaped to be directly useful.
There is a kludge in apache_cookie.c, but it might be better to backport
apreq-2's apreq_escape() code instead.  Not sure where to put it, though.

-- 
Joe Schaefer