Skip to content

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

Description

@Zrnik

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions