[pmwiki-users] WikiWord as you types in UTF-8

Petko Yotov 5ko at 5ko.fr
Sat Mar 3 01:53:14 CST 2012


cguenette at globetrotter.net writes:
> $MakePageNamePatterns = array(
>     "/'/" => '',                          # strip single-quotes
>     "/[^$PageNameChars\\s_]+/" => '',     # delete non-alnums
>     "/\\s+/" => '_'                       # convert spaces to underline
>     );
> function AsSpacedAsIs($str) { return $str; }
> $AsSpacedFunction = "AsSpacedAsIs";
> $GroupPattern = '[\\w]*(?:-\\w+)*';
> $NamePattern = '[\\w]*(?:-\\w+)*';
> function RemoveUnderline($str) { return strtr($str, '_', ' '); }
>  
> $FmtPV['$Title'] = $FmtPV['$Titlespaced'] = '@$page["title"] ? $page["title"] 
>  : RemoveUnderline($name)';
>  
> It's working perfectly until I got special french caracter (éèà, ect). Display i 
> s not OK and file name seams strange. 

1. Before this code you need to include_once the scripts/xlpage-utr-8.php  
file. This will initialize correctly $PageNameChars and other patterns for  
the UTF-8 encoding.

2. Don't define here $GroupPattern and $NamePattern to contain only plain  
letters and numbers. (Remove ot comment out these 2 lines.)

Petko




More information about the pmwiki-users mailing list