fix(parser): use ICU transliterator for platform-independent ASCII slugification
This commit is contained in:
parent
e8280b1f1d
commit
0805017a70
1 changed files with 7 additions and 0 deletions
|
|
@ -220,6 +220,13 @@ final readonly class IncoStringParser
|
|||
*/
|
||||
public static function slugify(string $value): string
|
||||
{
|
||||
if (\function_exists('transliterator_transliterate')) {
|
||||
$transliterated = \transliterator_transliterate('Any-Latin; Latin-ASCII', $value);
|
||||
if ($transliterated !== false) {
|
||||
return strtolower(trim($transliterated));
|
||||
}
|
||||
}
|
||||
|
||||
$ascii = (string) iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
|
||||
|
||||
return strtolower(trim($ascii));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue