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

cguenette at globetrotter.net cguenette at globetrotter.net
Sun Mar 4 10:44:59 CST 2012


This didn't fix the issue.
I used that instead:
function AsSpacedUTF8_FirstCapitalizeOnly($text) {
  $text = AsSpacedUTF8($text);
  $text = mb_convert_case($text, MB_CASE_LOWER, "UTF-8");
  $text = mb_ucfirst($text, "UTF-8");
  return $text;
}
function mb_ucfirst($str, $encoding = null) {
     $str = mb_strtoupper(mb_substr($str, 0,1,$encoding), $encoding) . 
mb_substr($str, 1, mb_strlen($str, $encoding)-1, $encoding);
     return $str;
}
$SpaceWikiWords = 1;
$AsSpacedFunction = 'AsSpacedUTF8_FirstCapitalizeOnly';and used the 
(:title:) to get uppercase in the title.

The international caracters display is OK. But I always get some issue with 
file name.

By example, I got a file name "Icons". In French, it's "Icônes" (notice the 
ô). This page have icons attach files .png. But files are not found when I 
click the link in (:attachlist:). If I create wikipage "Icones" and join the 
same files, it's OK. In wiki.d folder, the file name is "Site.Icônes". I 
guess Windows cannot figure out how to manage unicode file name.

I solution can be to save file name always with ASCII but to keep the 
original text as the title so file name will be "Icones" but it will display 
"Icônes" in a transparent matter for the end-user.

Not sure how to do that for now... I will begin to look the 
http://www.pmwiki.org/wiki/Cookbook/EditTitle and try to adapt that to 
remove the title field...

Caroline


----- Original Message ----- 
From: "Petko Yotov" <5ko at 5ko.fr>
To: "pmwiki-users" <pmwiki-users at pmichaud.com>
Sent: Saturday, March 03, 2012 2:53 AM
Subject: Re: [pmwiki-users] WikiWord as you types in UTF-8


> 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
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> 





More information about the pmwiki-users mailing list