gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

JSON file is partiary garbled when exporting my pattern containing the special character ©.

Open s56bouya opened this issue 3 years ago • 1 comments

Description

Not all special characters were checked, but besides ©, ® can also be reproduced.

When creating a pattern with some blocks containing ©, the exported JSON file fails to import.

Export JSON file sample

{
  "__file": "wp_block",
  "title": "test",
  "content": "<!-- wp:paragraph {\"align\":\"center\"} -->\n<p class=\"has-text-align-center\">�&nbsp;Theme</p>\n<!-- /wp:paragraph -->",
  "syncStatus": "unsynced"
}

Step-by-step reproduction instructions

  1. Put footer-01.php file in the patterns folder of the TT4 child theme
  2. Insert a pattern in the post → Create Pattern (either synchronous or asynchronous)
  3. Site Editor → Patterns → My Patterns → Export as JSON

/patterns/footer-01.php

<?php
/**
 * Title: Footer 01
 * Slug: twentytwentyfour/footer-01
 * Categories: footer
*/
?>
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><?php echo esc_html( '&copy;&nbsp;' . get_bloginfo( 'name' ) ); ?></p>
<!-- /wp:paragraph -->

Screenshots, screen recording, code snippet

https://github.com/WordPress/gutenberg/assets/15373114/be658588-6df3-4d0a-a1c5-2f2b966269e9

Environment info

WP 6.4.1 TT4 child theme

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

s56bouya avatar Nov 13 '23 03:11 s56bouya

Thanks for reporting the bug!

I believe this was fixed in https://github.com/WordPress/gutenberg/pull/55912, but it hasn't rolled out in a WordPress or Gutenberg release yet.

talldan avatar Nov 13 '23 05:11 talldan