Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52811 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22592 invoked from network); 2 Jun 2011 20:23:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jun 2011 20:23:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=andrei@zmievski.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andrei@zmievski.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zmievski.org from 209.85.161.42 cause and error) X-PHP-List-Original-Sender: andrei@zmievski.org X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:37388] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/E0-18291-051F7ED4 for ; Thu, 02 Jun 2011 16:23:44 -0400 Received: by fxm1 with SMTP id 1so1051177fxm.29 for ; Thu, 02 Jun 2011 13:23:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.2.205 with SMTP id 13mr271919fak.138.1307045732230; Thu, 02 Jun 2011 13:15:32 -0700 (PDT) Received: by 10.223.74.138 with HTTP; Thu, 2 Jun 2011 13:15:32 -0700 (PDT) X-Originating-IP: [173.164.152.242] In-Reply-To: <4C39B728-2283-49A7-87F5-B0CC9EC42505@bitextender.com> References: <4DE5368A.6050603@moonspot.net> <8BEEEE49-8DA3-4634-BF9C-120F7A15B613@roshambo.org> <4C39B728-2283-49A7-87F5-B0CC9EC42505@bitextender.com> Date: Thu, 2 Jun 2011 13:15:32 -0700 Message-ID: To: =?ISO-8859-1?Q?David_Z=FClke?= Cc: Martin Scotta , Sean Coates , Anthony Ferrara , PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: andrei@zmievski.org (Andrei Zmievski) Stop spreading FUD, please. It's no different than writing json_decode("=E4\u0123"). Your statement, "the stuff in bar in UTF-8" is wrong. The \u0123 escape sequence is a representation of a Unicode character, not the character itself. This representation can be encoded in any ASCII-compatible encoding, such as Latin-1, UTF-8, etc. So putting it directly in a Latin-1 encoded script is just fine. -Andrei On Thu, Jun 2, 2011 at 12:00 PM, David Z=FClke wrote: > No we can't; I already explained why in another email last night. Copypas= ta: > > json_decode() can deal with Unicode sequences because decodes to UTF-8. T= hat is not possible in a language construct: > > What if I do this, in a latin1 encoded file: > > $x =3D {foo: "=E4", bar: "\u0123"} > > Should that then give mixed encodings? The "=E4" in foo in latin1 and the= stuff in bar in UTF-8? > > And what if I do: > > $x =3D {foo: "=E4\u0123"} > > I'll either end up with an invalid UTF-8 sequence, or with latin1 charact= er soup. > > David > > > On 02.06.2011, at 18:04, Martin Scotta wrote: > >> Could we first go out with fully JSON compatible version for 5.4? >> and then later decide the =3D> stuff based on how that worked. >> >> Native JSON is a big stuff for userland, and I'm pretty sure it will bri= ng a >> hole of core version upgrades. >> >> Martin Scotta >> >> >> On Wed, Jun 1, 2011 at 7:09 PM, Sean Coates wrote: >> >>>> Now, the only reason I would personally support the array shortcut is >>>> if it was an implementation of JSON. =A0I know that's not on the table >>>> here >>> >>> I don't think anything is officially off the table, unless we forego >>> discussion. >>> >>> My application is largely JSON-powered. We pass data from back- to >>> front-end via JSON, we interact with MongoDB via the extension (which i= s an >>> altered JSON-like protocol (arrays instead of objects), but would be a = lot >>> more fluent with actual objects=97they're just too hard to make in curr= ent >>> PHP), and we interface with ElasticSearch. The paste I linked earlier i= s our >>> primary ElasticSearch query. >>> >>> The benefits of first-class JSON are important and wide-reaching; >>> especially when interacting with systems like the ones I've mentioned. >>> There's a huge amount of value in being able to copy JSON out of PHP an= d >>> into e.g. CURL to make a query to ElasticSearch without worrying that I= 've >>> accidentally nested one level too deep or shallow, or accidentally >>> mistranslating my arrays into JSON. >>> >>> This is not about saving five characters every time I type array(), it'= s >>> about making my systems all work together in a way that's a little less >>> abstracted, and a lot less prone to error. >>> >>> S >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >