WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #47420, comment 3


Ignore:
Timestamp:
05/28/2019 06:23:05 PM (19 months ago)
Author:
jeremyfelt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #47420, comment 3

    initial v1  
    1212Anything processed in PHP should effectively mimic what is done in JavaScript. So - if the block developer is encoding on the client side, they can use Gutenberg's `serializeAttributes()` (or something like it). But if they're encoding on the server side, they'll likely need to pass additional flags to `wp_json_encode()` so that those additional characters are encoded properly.
    1313
     14(Edit for clarification) These flags: `JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE` are what instruct `wp_json_encode()` to handle those additional characters properly.