Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Changed PSpellShell to work with UTF-8 encoded text in my environment
  • Loading branch information
goran committed Mar 30, 2010
1 parent d237b5f commit 5d8430c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions classes/PSpellShell.php
Expand Up @@ -44,7 +44,7 @@ function &checkWords($lang, $words) {
preg_match("/\& ([^ ]+) .*/i", $dstr, $matches);

if (!empty($matches[1]))
$returnData[] = utf8_encode(trim($matches[1]));

This comment has been minimized.

Copy link
@gjuric

gjuric Mar 31, 2010

Owner

We do not need to utf8_encode an UTF-8 string.

$returnData[] = trim($matches[1]);
}

return $returnData;
Expand All @@ -60,11 +60,6 @@ function &checkWords($lang, $words) {
function &getSuggestions($lang, $word) {
$cmd = $this->_getCMD($lang);

if (function_exists("mb_convert_encoding"))
$word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));

This comment has been minimized.

Copy link
@gjuric

gjuric Mar 31, 2010

Owner

This converts the string to ISO-8859-1 which can not display all UTF-8 characters

else
$word = utf8_encode($word);

This comment has been minimized.

Copy link
@gjuric

gjuric Mar 31, 2010

Owner

But this on the other hand converts from ISO-8859-1 to UTF-8?!? (see note 2 lines above)


if ($fh = fopen($this->_tmpfile, "w")) {
fwrite($fh, "!\n");
fwrite($fh, "^$word\n");
Expand Down

0 comments on commit 5d8430c

Please sign in to comment.