Permalink
Browse files

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 tinymce/tinymce_spellchecker_php#5
  • Loading branch information...
1 parent ed82e03 commit b43c2e9d397b8c3bd19e2ebf45e2481e794ded75 @skodak skodak committed with stronk7 Jan 2, 2012
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/editor/tinymce/tiny_mce/3.4.6/plugins/spellchecker/classes/PSpell.php
@@ -21,7 +21,7 @@ function &checkWords($lang, $words) {
$outWords = array();
foreach ($words as $word) {
if (!pspell_check($plink, trim($word)))
- $outWords[] = utf8_encode($word);
+ $outWords[] = $word;
}
return $outWords;
@@ -37,9 +37,6 @@ function &checkWords($lang, $words) {
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 @@ function &_getPLink($lang) {
$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']
);

0 comments on commit b43c2e9

Please sign in to comment.