From dc57ef04af4d12bb589c98e7457a22c44a091815 Mon Sep 17 00:00:00 2001 From: andi Date: Tue, 7 Jun 2005 21:44:56 +0200 Subject: AJAX spellchecker #29 This is nearly a complete rewrite of the gmail like AJAX spellchecker from http://www.broken-notebook.com/spell_checker/index.php Here are the differences and features * seemless integrated into DokuWiki * no need for the pspell extension * needs GNU aspell installed (not sure about the version I guess 0.60+ for UTF8) * needs PHP 4.3.0+ * uses SACK for AJAX * gets errors and suggestions in one transfer So far only tested in Firefox. It should work in IE, Safari and Opera 8, too. Please test and report back. darcs-hash:20050607194456-9977f-f699144d1fd28359742b2ce0f28c839a1f4cefbb.gz --- inc/utf8.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'inc/utf8.php') diff --git a/inc/utf8.php b/inc/utf8.php index 0b90c8586..70b16f1a5 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -105,7 +105,7 @@ function utf8_check($Str) { * @see utf8_decode() */ function utf8_strlen($string){ - return strlen(utf8_decode($str)); + return strlen(utf8_decode($string)); } /** @@ -125,6 +125,20 @@ function utf8_substr($str,$start,$length=null){ } } +/** + * Unicode aware replacement for substr_replace() + * + * @author Andreas Gohr + * @see substr_replace() + */ +function utf8_substr_replace($string, $replacement, $start , $length=0 ){ + $ret = ''; + if($start>0) $ret .= utf8_substr($string, 0, $start); + $ret .= $replacement; + $ret .= utf8_substr($string, $start+$length); + return $ret; +} + /** * Unicode aware replacement for explode * -- cgit v1.2.3