diff --git a/CHANGELOG.md b/CHANGELOG.md index 6150b4b88e0..9e7cba42788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where the control panel could display a notice about the Craft CMS license belonging to a different domain, even when accessing the control panel from the correct domain. ([#16396](https://github.com/craftcms/cms/issues/16396)) +- Fixed a bug where Unicode special characters weren’t getting stripped out of search keywords. ([#16430](https://github.com/craftcms/cms/issues/16430)) ## 4.13.9 - 2025-01-06 diff --git a/src/helpers/Search.php b/src/helpers/Search.php index 8be33b65c5b..941046a5d00 100644 --- a/src/helpers/Search.php +++ b/src/helpers/Search.php @@ -39,6 +39,10 @@ public static function normalizeKeywords(array|string $str, array $ignore = [], // Convert non-breaking spaces entities to regular ones $str = str_replace([' ', ' ', ' '], ' ', $str); + // Get rid of Unicode special characters + // (see https://github.com/craftcms/cms/issues/16430) + $str = preg_replace('/[\x{80}-\x{10FFFF}]/u', '', $str); + // Get rid of entities $str = preg_replace('/&#?[a-z0-9]{2,8};/i', '', $str);