Here is a solution to sort German UTF-8 page names, so characters äöüÄÖÜß
are placed within the alphabet:

// [(search .... sort=de )]
function BOLTsortDe($list) {
    usort($list, 'compareItemsDe');
    return $list;
}

function compareItemsDe($a, $b) {
   $anew = decodeDiacritics($a);
   $bnew = decodeDiacritics($b);
   if ($anew < $bnew) return -1;
   if ($anew > $bnew) return 1;
   return 0;
}

function decodeDiacritics($x) {
    $map = array(
            '%c3%84' => 'ae',
            '%c3%96' => 'oe',
            '%c3%9c' => 'ue',
            '%c3%a4' => 'ae',
            '%c3%b6' => 'oe',
            '%c3%bc' => 'ue',
            '%c3%9f' => 'ss',
    );
    return str_replace(array_keys($map), array_values($map), $x);
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to