Block Supports: Add missing UTF-8 conversion#24447
Conversation
|
@swissspidy: I'd love your eyes on this, if you can spare some time |
|
The fix for 8.7 needs to be applied to (Code was moved and files renamed by #24351) |
|
Size Change: +381 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
|
OK, so this is not affecting WP 5.5 (feel free to double-check), which makes sense considering that the functionality in question (Global Styles-related block support) was intentionally merged after code freeze. I'll update the metadata accordingly. |
|
I've also tested and confirmed that this does not appear to affect WordPRess 5.5. |
There was a problem hiding this comment.
I am not an expert in encodings nor DOM manipulations via PHP.
I have confirmed this bug is present in Gutenberg 8.7.
I have tested and confirms that this fixes it in my testing:
I've created a post with a Cover block containing the text こんにちは世界.
Without the patch:
With the patch applied (the block is un-edited):
This may be worth an 8.7.1 release.
😕 Seems like the DOM operation might remove the empty Cover div? 🤔 |
|
Seems to pass locally. I'll re-run the test. |
|
Passing now 😌 We should add some test coverage for this though 🤔 |
A simple unit test for |
|
I'll try writing a quick unit test for this. |
|
Added a unit test. I also discovered that I needed to add a line to convert HTML entities back to UTF-8 (after |
|
FWIW, cherry-picked the unit test commit on top of |
* Block Supports: Add missing UTF-8 conversion * Re-encode back to UTF-8 * Add unit test


Description
Fixes #24445.
This should probably be backported to 8.7 (and potentially further back if needed).
How has this been tested?
See #24445 for instructions on how to reproduce the issue. Verify that this PR fixes it.
Types of changes
Bug fix.
Checklist:
props @akirk @sirreal @simison for finding the fix