[pmwiki-devel] Search accent insensitive
Petko Yotov
5ko at 5ko.fr
Thu Jun 19 08:29:54 CDT 2014
Simon writes:
> « HTML content follows »
>
> The search is already case insensitive.
>
>
> How to make the search accent insensitive, ie a, ā, or â all the same?
You can define your own $StrFoldFunction :
$StrFoldFunction = 'FoldNZ';
function FoldNZ($str) {
$conversions = array(
'â' => 'a',
'ā' => 'a', # etc.
);
if(function_exists('utf8fold')) $str = utf8fold($str);
else $str = strtolower($str);
$str = str_replace(array_keys($conversions),array_values($conversions),$str);
return $str;
}
See as an example the function utf8fold() and the array $StringFolding in
the file scripts/xlpage-utf-8.php.
Note that you should look into the text source of your wiki files. If you
don't use UTF-8, chances are that your "ā" character is replaced by "ā"
or "ā", or something else. If that's the case, use 'ā' => 'a', in
your definitions.
Petko
More information about the pmwiki-devel
mailing list