--- swish.module-orig	2007-06-28 05:22:14.000000000 +0200
+++ swish.module	2007-10-07 12:10:58.408732750 +0200
@@ -215,6 +215,9 @@
       }
 
       $words = '"'.chop(str_replace('\(', '(', str_replace('\)', ')', str_replace('\*','*', escapeshellcmd($keys).' ')))).'"';
+	// convert from UTF-8 input to ISO-8859-1 since swish can't handle UTF-8
+	// ATTENTION: this conversion should only be done if the string is not yet in ISO-8859-1 (how to check this?)
+      $words = iconv ("UTF-8", "ISO-8859-1", $words);
       $swish_command = variable_get("swish_path","/usr/local/bin/swish-e") . escapeshellcmd(" -m 50 -f $swish_index  -w ").$words;      
       exec ($swish_command, $results, $return_val);
       foreach ($results as $result){
@@ -425,7 +428,12 @@
 
   if ($filter) { 
     // Limit the Output to 80000 characters
-    return utf8_encode(substr(shell_exec($filter . ' ' . $arg . ' '),0,80000));
+    $output = substr(shell_exec($filter . ' ' . $arg . ' '),0,80000);
+    // and check if search result is already in UTF-8 (is there a better way)
+    if ( strpos($output,"�",0) !== false ) // "�" is ALT+159  --> is already in utf8
+    	return $output;
+    else
+	return utf8_encode($output);
   }
 }
 
