MDL-30953 fix utf-8 support in PSpell class

Credit for discover and proposed fix goes to David Hai Gootvilig, this patch is part of https://github.com/moodle/custom-tinymce_spellchecker_php/tree/MOODLE_22_2.0.6b which will be used in the next tinymce import. It was reported upstream as https://github.com/tinymce/tinymce_spellchecker_php/pull/5
This commit is contained in:
Petr Skoda
2012-01-02 20:20:08 +01:00
committed by Eloy Lafuente (stronk7)
parent ed82e03798
commit b43c2e9d39
@@ -21,7 +21,7 @@ class PSpell extends SpellChecker {
$outWords = array();
foreach ($words as $word) {
if (!pspell_check($plink, trim($word)))
$outWords[] = utf8_encode($word);
$outWords[] = $word;
}
return $outWords;
@@ -37,9 +37,6 @@ class PSpell extends SpellChecker {
function &getSuggestions($lang, $word) {
$words = pspell_suggest($this->_getPLink($lang), $word);
for ($i=0; $i<count($words); $i++)
$words[$i] = utf8_encode($words[$i]);
return $words;
}
@@ -56,7 +53,7 @@ class PSpell extends SpellChecker {
$lang,
$this->_config['PSpell.spelling'],
$this->_config['PSpell.jargon'],
$this->_config['PSpell.encoding'],
empty($this->_config['PSpell.encoding']) ? 'utf-8' : $this->_config['PSpell.encoding'],
$this->_config['PSpell.mode']
);