Re: [RFC] Unicode Escape Syntax
| From: | Andrea Faulds | Date: | Tue, 25 Nov 2014 10:03:54 +0000 |
| Subject: | Re: [RFC] Unicode Escape Syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79152@lists.php.net to get a copy of this message | ||
> On 25 Nov 2014, at 08:33, Markus Fischer <markus@fischer.name> wrote:
>
>> On 24.11.14 23:09, Andrea Faulds wrote:
>> Good evening,
>>
>> Here’s a new RFC: https://wiki.php.net/rfc/unicode_escape
>
> I think the choice of \u{xx} is interesting, i.e. using '{' and '}'.
>
> Afaik, one of the current best practices is to use json_decode(), like so:
>
> $ cat test.php
> <?php var_dump( json_decode( '"\u00c4"' ) );
>
> $ php test.php
> string(2) "Ä"
json_decode is an interesting workaround, but JSON suffers from JavaScript, where it got its syntax,
having poor Unicode handling. JSON's Unicode escapes only allow BMP characters and, worse,
non-BMP characters must be encoded using surrogate pairs.
--
Andrea Faulds
http://ajf.me/