Re: [PHP-DEV] json_encode() x-notation

2018-07-04 Thread David Rodrigues
Em qua, 4 de jul de 2018 19:01, Nikita Popov escreveu: > On Fri, Jun 29, 2018 at 8:51 PM, David Rodrigues > 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"'); // =>

Re: [PHP-DEV] json_encode() x-notation

2018-07-04 Thread Nikita Popov
On Fri, Jun 29, 2018 at 8:51 PM, David Rodrigues 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(

Re: [PHP-DEV] json_encode() x-notation

2018-06-29 Thread Sara Golemon
On Fri, Jun 29, 2018 at 1:51 PM, David Rodrigues 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? > The TL;DR version AIUI, is that JSON strings are Unicode strings, so any byte sequence in a JSON

[PHP-DEV] json_encode() x-notation

2018-06-29 Thread David Rodrigues
​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"'); // => @ While PHP: json_decode('"\\u0040"'); // => @ json_decode('"\\x40"'); // => null (Syntax error)