With international characters in the header tags, the anchor names end up a real mess:
<h3>Område 1</h3> becomes #Omr%C3%A5de+1
if you add a function to clean the characters before you print them, for example like this:
function toAscii($str, $replace=array(), $delimiter='-') {
if( !empty($replace) ) {
$str = str_replace((array)$replace, ' ', $str);
}
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
return $clean;
}
(from http://cubiq.org/the-perfect-php-clean-url-generator)
and then calling it in the proper places, for example replacing
$rtext='<a name="'.urlencode(strip_tags($val[2])).'"></a>';
with
$rtext='<a name="'.urlencode($this->toAscii(strip_tags($val[2]))).'"></a>';
you end up with the anchor name #omrade-1 instead. Much better in my view.