Search code examples
phputf-8iso-8859-1iconv

PHP - convert incorrect umlauts (utf8)


how can I convert incorrect Umlauts like:

 ä <- ä
 Ä <- Ä
 ö <- ö
 Ö <- Ö
 ü <- ü
 Ü <- Ãœ
 ß <- ß
…

Thats my current Code but it is not working:

echo iconv("ISO-8859-1", "UTF-8" "Ü");

Solution

  • Try this. It outputs: äÄöÖüÜß

    <?php
    
    $inputs = [ 'ä', 'Ä', 'ö', 'Ö', 'ü', 'Ü', 'ß' ];
    
    foreach ($inputs as $input)
    {
        echo iconv('UTF-8', 'WINDOWS-1252//TRANSLIT', $input);
    }