diff --git a/CHANGELOG.md b/CHANGELOG.md index 2989e724d..b6d3fd96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # v1.7.46 ## 05/15/2024 +1. [](#new) + * Added a new `Utils::toAscii()` method to remove UTF-8 characters from string +1. [](#bugfix) + * Fixed some deprecated issues in Filesystem [#3831](https://github.com/getgrav/grav/issues/3831) + +# v1.7.46 +## 05/15/2024 + 1. [](#improved) * Better handling of external protocols in `Utils::url()` such as `mailto:`, `tel:`, etc. * Handle `GRAV_ROOT` or `GRAV_WEBROOT` when `/` [#3667](https://github.com/getgrav/grav/pull/3667) diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index a518ec199..c01275423 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -1888,6 +1888,14 @@ public static function processMarkdown($string, $block = true, $page = null) return $string; } + public function toAscii(String $string): String + { + return strtr(utf8_decode($string), + utf8_decode( + 'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ'), + 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'); + } + /** * Find the subnet of an ip with CIDR prefix size *