summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-09-23 17:19:37 +0200
committerchris <chris@jalakai.co.uk>2006-09-23 17:19:37 +0200
commit720307d9ce09c85c3b6037fed985128b2bd860a4 (patch)
treeb200b5acd78ccff53062fa5c1c79be2617c16c59 /inc/utf8.php
parent56ee955725f8093f79a9c9beeef86c4f2df3abf4 (diff)
downloadrpg-720307d9ce09c85c3b6037fed985128b2bd860a4.tar.gz
rpg-720307d9ce09c85c3b6037fed985128b2bd860a4.tar.bz2
utf8_stripspecials optimization
Add preconverted utf-8 string of special characters. The (once only) conversion of the special character unicode array into utf-8 occurs on every DokuWiki page view, irrespective of action or caching, and takes about one third of the time involved in delivering a wiki page straight from cache. The original unicode array has been left in place in the file to make any future amendments easier. darcs-hash:20060923151937-9b6ab-cae0340a95d9596415ef71d7b7e67ef9daca84ef.gz
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index dbf09b6fc..0479d8809 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -366,10 +366,12 @@ function utf8_romanize($string){
*/
function utf8_stripspecials($string,$repl='',$additional=''){
global $UTF8_SPECIAL_CHARS;
+ global $UTF8_SPECIAL_CHARS2;
static $specials = null;
if(is_null($specials)){
- $specials = preg_quote(unicode_to_utf8($UTF8_SPECIAL_CHARS), '/');
+# $specials = preg_quote(unicode_to_utf8($UTF8_SPECIAL_CHARS), '/');
+ $specials = preg_quote($UTF8_SPECIAL_CHARS2, '/');
}
return preg_replace('/['.$additional.'\x00-\x19'.$specials.']/u',$repl,$string);
@@ -988,6 +990,26 @@ $UTF8_SPECIAL_CHARS = array(
0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d,
);
+// utf8 version of above data
+global $UTF8_SPECIAL_CHARS2;
+$UTF8_SPECIAL_CHARS2 =
+ ' !"#$%&\'()+,/;<=>?@[\]^`{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•�'.
+ '�—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½�'.
+ '�¿×÷ˇ˘˙˚˛˜˝̣̀́̃̉΄΅·βφϑϒϕϖְֱֲֳִֵֶַָֹֻּֽ־ֿ�'.
+ '�ׁׂ׃׳״،؛؟ـًٌٍَُِّْ٪฿‌‍‎‏–—―‗‘’‚“”�'.
+ '��†‡•…‰′″‹›⁄₧₪₫€№℘™Ωℵ←↑→↓↔↕↵'.
+ '⇐⇑⇒⇓⇔∀∂∃∅∆∇∈∉∋∏∑−∕∗∙√∝∞∠∧∨�'.
+ '�∪∫∴∼≅≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌐⌠⌡〈〉⑩─�'.
+ '��┌┐└┘├┤┬┴┼═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠'.
+ '╡╢╣╤╥╦╧╨╩╪╫╬▀▄█▌▐░▒▓■▲▼◆◊●�'.
+ '�★☎☛☞♠♣♥♦✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕�'.
+ '��✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱'.
+ '✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋�'.
+ '�❏❐❑❒❖❘❙❚❛❜❝❞❡❢❣❤❥❦❧❿➉➓➔➘➙➚�'.
+ '��➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➱➲➳➴➵➶'.
+ '➷➸➹➺➻➼➽➾�'.
+ '�ﹼﹽ';
+
/**
* Romanization lookup table
*