Im having problems to convert æ
, ø
, and å
into ae
, oe
and aa
.
I am trying to make a seo friendly url with this function, but it just removes the æøå
signs.
My function is:
function seo_friendly_url($string, $cid) {
//Unwanted: {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( )
$string = strtolower($string);
//Convert ÆØÅ
$string = str_replace(chr(230), 'ae', $string);
$string = str_replace(chr(248), 'oe', $string);
$string = str_replace(chr(229), 'aa', $string);
//Strip any unwanted characters
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
//Clean multiple dashes or whitespaces
$string = preg_replace("/[\s-]+/", " ", $string);
//Convert whitespaces and underscore to dash
$string = preg_replace("/[\s_]/", "-", $string);
return $string;
}
Does anyone got any ideas on how to solve this issue. I have tried many difference things found around the web, but nothing seems to be working.