diff options
author | andi <andi@splitbrain.org> | 2005-01-17 20:21:12 +0100 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-01-17 20:21:12 +0100 |
commit | c41c03f3ff20658df6ec6c2e7808c5051a802a70 (patch) | |
tree | 967c6a98514cdaec67e610d6e14db91ecfb645db /inc/common.php | |
parent | 87a1de9a52fbcb1a410d4d1da98d224536629549 (diff) | |
download | rpg-c41c03f3ff20658df6ec6c2e7808c5051a802a70.tar.gz rpg-c41c03f3ff20658df6ec6c2e7808c5051a802a70.tar.bz2 |
cleanID UTF8 patch
darcs-hash:20050117192112-9977f-084e54a393e8ff0af3954e3a51b8072931529f9b.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/inc/common.php b/inc/common.php index eb7902106..ac5332a3e 100644 --- a/inc/common.php +++ b/inc/common.php @@ -8,6 +8,7 @@ require_once("conf/dokuwiki.php"); require_once("inc/io.php"); + require_once('inc/utf8.php'); //set up error reporting to sane values error_reporting(E_ALL ^ E_NOTICE); @@ -392,32 +393,41 @@ function cleanID($id){ global $conf; global $lang; $id = trim($id); - $id = strtolower($id); + $id = utf8_strtolower($id); //alternative namespace seperator $id = strtr($id,';',':'); if($conf['useslash']) $id = strtr($id,'/',':'); + //FIXME use config to ask for deaccenting + $id = utf8_deaccent($id,-1); + + //remove specials (only ascii specials are removed) + $id = preg_replace('#[ !"§$%&()\[\]{}\\?`\'\#~*+=,<>\|^°@µ¹²³¼½¬]#u','_',$id); + +/* DELETEME legacy code if(!$conf['localnames']){ if($lang['encoding'] == 'iso-8859-15'){ // replace accented chars with unaccented ones // this may look strange on your terminal - just don't touch $id = strtr( strtr($id, - '', + 'ÀÁÂÃÅÇÈÉÊËÌÍÎÏÑÒÓÔÕØÙÚÛÝàáâãåçèéêëìíîïñòóôõøùúûýÿ', 'szszyaaaaaceeeeiiiinooooouuuyaaaaaceeeeiiiinooooouuuyy'), - array('' => 'th', '' => 'th', '' => 'dh', '' => 'dh', '' => 'ss', - '' => 'oe', '' => 'oe', '' => 'ae', '' => 'ae', '' => 'u', - '' => 'ue', '' => 'oe', '' => 'ae', '' => 'ue', '' => '', - '' => 'ae')); + array('Þ' => 'th', 'þ' => 'th', 'Ð' => 'dh', 'ð' => 'dh', 'ß' => 'ss', + '' => 'oe', '' => 'oe', 'Æ' => 'ae', 'æ' => 'ae', 'µ' => 'u', + 'ü' => 'ue', 'ö' => 'oe', 'ä' => 'ae', 'Ü' => 'ue', 'Ö' => 'ö', + 'Ä' => 'ae')); } $WORD = 'a-z'; }else{ $WORD = '\w'; } - //special chars left will be converted to _ $id = preg_replace('#[^'.$WORD.'0-9:\-\.]#','_',$id); +*/ + + //clean up $id = preg_replace('#__#','_',$id); $id = preg_replace('#:+#',':',$id); $id = trim($id,':._-'); |