Re: [PATCH] adding RFC3984 support to http_build_query

From: Date: Wed, 05 Jan 2011 12:17:39 +0000
Subject: Re: [PATCH] adding RFC3984 support to http_build_query
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-51218@lists.php.net to get a copy of this message
Instead of a boolean, could you add a rfc-xx selection parameter instead, like, in case one would like rfc 3986 instead? On Jan 5, 2011 8:10 PM, "Rui Hirokawa" <rui_hirokawa@yahoo.co.jp> wrote: > Hello, > > I made a patch to add the RFC-3984 based url-encoding support > into http_build_query(). > > The http_build_query() is quite useful, but, > it isn't based on the official url-encoding scheme (RFC-3984) > for ~ (tilde) and ' '(space). > > I added an optional (the 4th) parameter 'is_rfc3984'. > If it is true (false by default, now), RFC3984 based > url-encoding scheme (it is same as rawurlencode() ) is used. > > A simple example shown as bellow, > > $v = array('foo'=>'m o','boo'=>'[^~]'); > > // result: foo=m+p&boo=%5B%5E%7E5D > echo http_build_query($v, null, '&'); > > // result: foo=m%20p&boo=%5B%5E~5D (RFC-3986 compatible) > echo http_build_query($v, null, '&', true); > > // result: foo=m%20p&boo=%5B%5E~5D (RFC-3986 compatible) > echo rawurlencode($v['foo']).'&'.rawurlencode($v['boo']); > > > I'm going to commit the patch if it is accepted. > > Rui

« previous php.internals (#51218) next »