Skip to content

Conversation

jtojnar
Copy link

@jtojnar jtojnar commented Oct 4, 2025

mbstring extension in PHP 8.2 deprecates HTML-ENTITIES encoding:
https://php.watch/versions/8.2/mbstring-qprint-base64-uuencode-html-entities-deprecated

However, there is no need to use it to the UTF-8 representation of NBSP, one can just directly use \u{0a} (or \xc2\x0a for PHP < 7.0).

Or, even better, we can enable PCRE_UTF8 mode:

https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

That will remove all Unicode whitespace characters, not just the ASCII ones and nbsp because u modifier in PHP enables PCRE_UCP as well PCRE_UTF options:

php/doc-en#2831

It is supposed to be available since PHP 5.1:

https://www.phpbb.com/community/viewtopic.php?t=733515

mbstring extension in PHP 8.2 deprecates `HTML-ENTITIES` encoding: https://php.watch/versions/8.2/mbstring-qprint-base64-uuencode-html-entities-deprecated However, there is no need to use it to the UTF-8 representation of NBSP, one can just directly use `\u{0a}` (or `\xc2\x0a` for PHP < 7.0). Or, even better, we can enable `PCRE_UTF8` mode: https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php That will remove all Unicode whitespace characters, not just the ASCII ones and nbsp because `u` modifier in PHP enables `PCRE_UCP` as well `PCRE_UTF` options: php/doc-en#2831 It is supposed to be available since PHP 5.1: https://www.phpbb.com/community/viewtopic.php?t=733515
@jtojnar jtojnar force-pushed the wip/jtojnar/unitrim-mbstring-depr branch from aa85520 to 7e990a6 Compare October 4, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant