Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6962 invoked by uid 1010); 27 Apr 2007 19:58:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6947 invoked from network); 27 Apr 2007 19:58:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2007 19:58:44 -0000 Authentication-Results: pb1.pair.com header.from=antony@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=antony@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: antony@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:55563] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/B9-29267-1F552364 for ; Fri, 27 Apr 2007 15:58:44 -0400 Received: (qmail 23769 invoked from network); 27 Apr 2007 19:58:38 -0000 Received: from internal.zend.office (HELO ?127.0.0.1?) (10.1.1.1) by internal.zend.office with SMTP; 27 Apr 2007 19:58:38 -0000 Message-ID: <463255F0.6060108@zend.com> Date: Fri, 27 Apr 2007 23:58:40 +0400 User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Tyler Lawson CC: internals@lists.php.net References: <200704271939.l3RJdkQG025948@server2.n49.com> In-Reply-To: <200704271939.l3RJdkQG025948@server2.n49.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] JSON ampersand patch From: antony@zend.com (Antony Dovgal) On 04/27/2007 11:39 PM, Tyler Lawson wrote: > Hello, > > I hope this is the right place for this, as I'd like to post a patch for > your consideration to the way the JSON handles ampersands. I have had > problems sending JSON data back and forth over POST requests, where an > ampersand separates variables. This patch will convert "&" into "\u0026", > which will allow ampersands to travel freely and be parsed by any valid JSON > decoder. I believe a short reproduce case would explain it better. > This has been applied against php-5.2.1 > > --- json.c 2007-01-12 07:17:32.000000000 -0500 > +++ my_json.c 2007-04-27 15:12:44.000000000 -0400 > @@ -301,6 +301,11 @@ > smart_str_appendl(buf, "\\t", 2); > } > break; > + case '&': > + { > + smart_str_appendl(buf, "\\u0026", 6); > + } > + break; > default: > { > if (us < ' ' || (us & 127) == us) > > > Tyler > -- Wbr, Antony Dovgal