Skip to content

Commit

Permalink
Utils::toAscii() func
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jun 4, 2024
1 parent 856a478 commit 25ace64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 8 additions & 0 deletions system/src/Grav/Common/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 25ace64

Please sign in to comment.