nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

Home Page:https://doc.nette.org/utils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

German umlauts are converted incorrectly with "toAscii" (webalize) method

Zrnik opened this issue · comments

Version: i think every version

Bug Description

Method toAscii (and thus webalize) is incorrectly converting german umlauts.

Reproduce

<?php declare(strict_types=1);

include __DIR__ . '/src/Utils/StaticClass.php';
include __DIR__ . '/src/Utils/Callback.php';
include __DIR__ . '/src/Utils/Strings.php';

$ok = "✔️";
$err = "";

$CorrectConversions = [
    "Jägermeister" => "jaegermeister",
    "Würth" => "wuerth",
    "Löwenbräu" => "loewenbraeu",
    "Straße" => "strasse"
];

foreach ($CorrectConversions as $toConvert => $correctConversion) {
    $converted = \Nette\Utils\Strings::webalize($toConvert);
    $isCorrect = $converted === $correctConversion;
    echo $toConvert . " (".$correctConversion.") => " . ($isCorrect ? $ok : $err) . " " . $converted . PHP_EOL;
}

Result:

Jägermeister (jaegermeister) => ❌ jagermeister
Würth (wuerth) => ❌ wurth
Löwenbräu (loewenbraeu) => ❌ lowenbrau
Straße (strasse) => ✔️ strasse

Expected Behavior

Jägermeister (jaegermeister) => ✔️ jaegermeister
Würth (wuerth) => ✔️ wuerth
Löwenbräu (loewenbraeu) => ✔️ loewenbraeu
Straße (strasse) => ✔️ strasse