SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

From: Geoffrey T. D. <da...@us...> - 2001年03月07日 16:43:39
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv29551/lib
Modified Files:
	config.php transform.php 
Log Message:
Recognize international characters in WikiWords.
We do this by using POSIX character classes (like [[:upper:]]) in the
perl regexps. Getting this to work involves calling setlocale().
(See comments in lib/config.php for more details.)
I suspect my current hacks will not work in all PHP environments. I'd
appreciate success/failure reports.
Index: config.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** config.php	2001年02月16日 04:43:07	1.34
--- config.php	2001年03月07日 16:45:20	1.35
***************
*** 96,99 ****
--- 96,121 ----
 }
 
+ // To get the POSIX character classes in the PCRE's (e.g.
+ // [[:upper:]]) to match extended characters (e.g. GrüßGott), we have
+ // to set the locale, using setlocale().
+ //
+ // The problem is which locale to set? We would like to recognize all
+ // upper-case characters in the iso-8859-1 character set as upper-case
+ // characters --- not just the one's which are in the current $LANG.
+ //
+ // As it turns out, at least on my system (Linux/glibc-2.2) as long as
+ // you setlocale() to anything but "C" it works fine. (I'm not sure
+ // whether this is how it's supposed to be, or whether this is a bug
+ // in the libc...)
+ //
+ // We don't currently use the locale setting for anything else, so for
+ // now, just set the locale to US English.
+ //
+ // FIXME: Not all environments may support en_US? We should probably
+ // have a list of locales to try.
+ 
+ if (setlocale('LC_CTYPE', 0) == 'C')
+ setlocale('LC_CTYPE', 'en_US.iso-8859-1');
+ 
 //////////////////////////////////////////////////////////////////
 // Autodetect URL settings:
Index: transform.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** transform.php	2001年03月02日 21:16:05	1.19
--- transform.php	2001年03月07日 16:45:20	1.20
***************
*** 284,288 ****
 if (function_exists('wtt_interwikilinks')) {
 $transform->register(WT_TOKENIZER, 'wtt_interwikilinks',
! 			"!?(?<![A-Za-z0-9])$InterWikiLinkRegexp:$WikiNameRegexp");
 }
 $transform->register(WT_TOKENIZER, 'wtt_bumpylinks', "!?$WikiNameRegexp");
--- 284,288 ----
 if (function_exists('wtt_interwikilinks')) {
 $transform->register(WT_TOKENIZER, 'wtt_interwikilinks',
! 			"!?(?<![[:alnum:]])$InterWikiLinkRegexp:$WikiNameRegexp");
 }
 $transform->register(WT_TOKENIZER, 'wtt_bumpylinks', "!?$WikiNameRegexp");
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /