Izvadot $replace ir ascii pārbaudīju to ar mb_detect_encoding() formātā!
Mēģināju ar mb_convert_encoding() funkciju, bet viņš atmet to simbolu kurš tiek pārvērsts no ASCII uz UTF-8
function fixlink($title){
$characters=array("ā","č","ē","ģ","ī","ķ","ļ","ņ","š","ū","ž"," ");
$replace=array("a","c","e","g","i","k","l","n","s","u","z","");
return str_replace($characters2,$replace,strtolower($title));
}