Tests: Remove unnecessary use of utf8_encode()
in KSES tests.
One of the tests for the wp_kses_xml_named_entities()
function used utf8_encode( chr( 160 ) )
to set an expectation of a Unicode character for a non-breaking space.
It is understandable that this expectation was previously set this way, as it is not possible for a developer to distinguish between a breaking space and a non-breaking space visually, so the chances of the test accidentally breaking on an incorrect save when the plain Unicode character would be used, was high.
However, the utf8_encode()
function is deprecated as of PHP 8.2, and its use needs to be removed from the WP codebase.
PHP 7.0 has introduced Unicode escape sequences, which allows to create a text string using Unicode characters referenced by their codepoint. By switching the test case to provide the test expectation using a Unicode escape sequence, we remove the use of the deprecated PHP function and still preserve the safeguard against the test accidentally breaking.
Follow-up to [52229].
Props jrf, afercia, poena, SergeyBiryukov.
See #55603, #60705.