Em qua, 4 de jul de 2018 19:01, Nikita Popov <nikita....@gmail.com>
escreveu:

> On Fri, Jun 29, 2018 at 8:51 PM, David Rodrigues <david.pro...@gmail.com>
> wrote:
>
>> ​Hello. I saw that JS supports the x-notation (\x40) and u-notation
>> (\u0040), but PHP only supports u-notation. There some reason for that?
>>
>> JSON.parse('"\x40"'); // => @
>> JSON.parse('"\u0040"'); // => @
>>
>
> No it doesn't. JSON.parse() will correctly reject \x escapes because they
> aren't valid JSON. You are using a normal JS string (which has nothing to
> do with JSON and supports \x), which will unescape \x before JSON.parse()
> ever sees it. If you write JSON.parse('"\\x40"') or similar, you will get
> an error.
>

Oh! You are right. I just forgot to test this case. :D Topic is closed if
no one have no more to say, so.


> Nikita
>

Reply via email to