Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51219 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71980 invoked from network); 5 Jan 2011 12:50:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2011 12:50:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=rui_hirokawa@yahoo.co.jp; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rui_hirokawa@yahoo.co.jp; sender-id=pass; domainkeys=good Received-SPF: pass (pb1.pair.com: domain yahoo.co.jp designates 114.111.99.165 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rui_hirokawa@yahoo.co.jp X-Host-Fingerprint: 114.111.99.165 smtp504.mail.kks.yahoo.co.jp Received: from [114.111.99.165] ([114.111.99.165:39999] helo=smtp504.mail.kks.yahoo.co.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/E4-32752-909642D4 for ; Wed, 05 Jan 2011 07:50:20 -0500 Received: (qmail 28287 invoked by alias); 5 Jan 2011 12:50:14 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20050223; d=yahoo.co.jp; h=Received:X-Apparently-From:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=cOnd5Gkvo0R+EiBjcRbZvCoz+d2chkR9xA6q1sRJJQJXJcAFHB3oshfrJQnfVin7Tb3uQe6SbdqSxfOylLpmwQ4KjJr1Kzt3No4d0YDIbpCGljKREY1cIGGJOUltXxVi ; Received: from unknown (HELO ?192.168.1.3?) (rui_hirokawa@110.233.141.192 with plain) by smtp504.mail.kks.yahoo.co.jp with SMTP; 5 Jan 2011 12:50:14 -0000 X-Apparently-From: Message-ID: <4D246901.5010400@yahoo.co.jp> Date: Wed, 05 Jan 2011 21:50:09 +0900 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Tjerk Meesters CC: internals@lists.php.net References: <4D245F5B.3050707@yahoo.co.jp> In-Reply-To: Content-Type: multipart/alternative; boundary="------------030607080307000509080605" Subject: Re: [PHP-DEV] [PATCH] adding RFC3984 support to http_build_query From: rui_hirokawa@yahoo.co.jp (Rui Hirokawa) --------------030607080307000509080605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, Thank you for the comment. How about adding two PHP constant, PHP_QUERY_RFC1738 (default) and PHP_QUERY_RFC3986 ? It is like, echo http_build_query($v, null, '&'); echo http_build_query($v, null, '&',PHP_QUERY_RFC1738); echo http_build_query($v, null, '&', PHP_QUERY_RFC3986); Rui (2011/01/05 21:17), Tjerk Meesters wrote: > > 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" > 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 --------------030607080307000509080605--