I build a script that should generate an sitemap for my project.
This script use strtr() to replace unwanted signs and also convert German umlauts.
$ers = array( '<' => '', '>' => '', ' ' => '-', 'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue', 'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'ß' => 'ss', '&' => 'und', '*' => '', ' - ' => '-', ',' => '', '.' => '', '!' => '', '?' => '' );
foreach ($rs_post as $row) {
$kategorie = $row['category'];
$kategorie = strtr($kategorie,$ers);
$kategorie = strtolower($kategorie);
$kategorie = trim($kategorie);
$org_file .= "<url><loc>https://domain.org/kategorie/" . $kategorie . "/</loc><lastmod>2016-08-18T19:02:42+00:00</lastmod><changefreq>monthly</changefreq><priority>0.2</priority></url>" . PHP_EOL;
}
Unwanted signs like "<" will be replaced correctly, but the German umlauts are not converted. I have no idea why.
Someone has a tipp for me?
Torsten