Opened 4 weeks ago
Last modified 2 days ago
#66093 new defect (bug)
Combining characters aren't normalized to Unicode Form C on output
| Reported by: | edent | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Awaiting Review |
| Component: | Charset | Version: | 7.1 |
| Severity: | minor | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description (last modified by )
The HTML produced by WordPress functions like get_the_excerpt() and the_content() doesn't perform any Unicode Normalization.
This lack of normalisation is problematic because the W3C recommends Normalization Form C - https://www.w3.org/TR/charmod-norm/
It is possible to wrap these functions - for example normalizer_normalize( get_the_excerpt(), Normalizer::FORM_C ); - but this quickly becomes cumbersome in complex themes.
Would it make sense for WordPress to ensure that the content coming out of the post object is normalized before being returned?
Test
My blog post contains the text Anaïs. The ï is U+0069 LATIN SMALL LETTER I and U+0308 COMBINING DIAERESIS.
When I run the output of the_content() through the W3C Validator, it complains
Warning: Text run is not in Unicode Normalization Form C.
Background
There's this previous ticket which talks about normalizing in the editor and on save - #30130.
However, for anyone saving plain text / markdown this doesn't seem to work. Text is saved un-normalised.
Change History (3)
#1
@
4 weeks ago
- Summary Combinging characters aren't normalized to Unicode Form C on output → Combining characters aren't normalized to Unicode Form C on output
This ticket was mentioned in PR #14105 on WordPress/wordpress-develop by @testerrahul.
2 days ago
#3
- Keywords has-patch has-unit-tests added
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Fixes #66093
Summary
the_content()andget_the_excerpt()to Unicode NFC when theintlextension is available.Testing
vendor/bin/phpunit -c phpunit.xml.dist tests/phpunit/tests/post/getTheExcerpt.phpvendor/bin/phpunit -c phpunit.xml.dist tests/phpunit/tests/post/getTheContent.phpvendor/bin/phpcs --standard=phpcs.xml.diston all four changed filesgit diff --checkThe focused PHPUnit files passed: 18 tests, 26 assertions total.