Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102531 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76358 invoked from network); 29 Jun 2018 18:51:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2018 18:51:30 -0000 Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.41 as permitted sender) X-PHP-List-Original-Sender: david.proweb@gmail.com X-Host-Fingerprint: 209.85.214.41 mail-it0-f41.google.com Received: from [209.85.214.41] ([209.85.214.41:54108] helo=mail-it0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/A2-52152-1BF763B5 for ; Fri, 29 Jun 2018 14:51:29 -0400 Received: by mail-it0-f41.google.com with SMTP id a195-v6so4210713itd.3 for ; Fri, 29 Jun 2018 11:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=QOFGEnjlKb7MlyOZiw7UhHAWK6SijyeUI6Xxt1qJtDk=; b=ZDtutZdDDgy98Rv2d6fbj0a1vUgPX7KL+OoO9h+eCvYMGlZgbDFwY8gm88cT0L2S/w Ja2aiI4M7ODvv/y+yRL6cPMfJvHOeerO+vOuwhceeMaFMybcUHq8QVymkRtLiroY457K f4qlhy/tIXYa+jWKjvxrYOvrZj/JLDFEp8Su/Wt5JSXYyk9HLtZu4bqmr74JTAisoR2t pRme30m0Ex362APIUOJA4QGcAHArPKGB4AlYhoNvztaxMVmC32pO9Bk1ihVsrvgxa9Tf 3FPN8rpeFneoUry8FDQ/nBWdrVF4ERyhvMzyKfElRkStK0l4l1SKUMBV1UCpY/eJ8cKy tEqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QOFGEnjlKb7MlyOZiw7UhHAWK6SijyeUI6Xxt1qJtDk=; b=suIYJryEg/G5sreO3TYkIgYTDXAXAD4zTLYWw0ZvgiHojRVXPwu9zbkD/8d5syhn+E wU+WSD13LGjxTb25gvKnTq5Cl58FQAslEjm8acs43gq0Yci4Vn0R/MaK973fw3FdmRhR WM2DGDGhY+Ki755cgECdv1uGDebNYRDswAJ0yc31PXn9K9rEvXR0mb4SCY/HYHAMAvLF wLFrRTSq4b4NGEex9Z2sm0F1Cvd1WS588pdSVe5uZbkfMuNqzSYLE11xZPqvJNioCljP ySSj7zq0+5Lg1owvJ5D9Z23QVHDTlOTqaaGz45xPfbtPyqudo44Bxt2QsuIfF7+RQ58n vIBQ== X-Gm-Message-State: APt69E23sUu1rgaHp3rtXqfAmRJWtLfa7QA07ksYXJfk9/WyJO0L0G6h Hns1zl0LftJyaoCHs0hqHo96+6OXR1ezHPxoxg8HKQ== X-Google-Smtp-Source: AAOMgpeDKrR3oPpfX6DH42qltVlL2PiE3J4qoW0elv8TJ+lEeAi2aebBR/HxjcZtz+DFpkasUs/7imAdy6/R6rTM93Y= X-Received: by 2002:a24:2186:: with SMTP id e128-v6mr2854438ita.39.1530298286465; Fri, 29 Jun 2018 11:51:26 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 29 Jun 2018 15:51:15 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000c3ea69056fcc55f3" Subject: json_encode() x-notation From: david.proweb@gmail.com (David Rodrigues) --000000000000c3ea69056fcc55f3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =E2=80=8BHello. 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"'); // =3D> @ JSON.parse('"\u0040"'); // =3D> @ While PHP: json_decode('"\\u0040"'); // =3D> @ json_decode('"\\x40"'); // =3D> null (Syntax error) The json.org really don't seems doc the x-notation version, but some pages does: http://www.javascriptkit.com/jsref/escapesequence.shtml The same is valid to json_encode('@'), it will stringify to '\u0040' instead of the most simplified version '\x40'. I don't know if there are some reason for that, but I think that, at least, is reasonable to json_decode() supports that. --=20 David Rodrigues --000000000000c3ea69056fcc55f3--