--- plugins/spamlookup/lib/spamlookup.pm.bak	Tue Sep 27 11:31:10 2005
+++ plugins/spamlookup/lib/spamlookup.pm	Fri Oct 28 13:42:03 2005
@@ -410,6 +410,10 @@
 
 sub wordlist_match {
     my ($text, $patterns) = @_;
+    require Encode;
+    my $enc = MT::ConfigMgr->instance->PublishCharset;
+    $text = Encode::decode($enc, $text);
+    $patterns = Encode::decode($enc, $patterns);
 
     $text ||= '';
     my @patt = split /[\r\n]+/, $patterns;
@@ -432,10 +436,14 @@
             $re = '(?'.$opt.':'.$re.')' if $opt;
             $re = eval { qr/$re/ };
             $re = '\b' . quotemeta($patt) . '\b' if $@;
-            push @matches, [ $patt, $1, int($score) ] if $text =~ m/($re)/;
+            push @matches, [ Encode::encode($enc, $patt),
+                             Encode::encode($enc, $1), int($score) ]
+                if $text =~ m/($re)/;
         } else {
             my $re = '\b' . quotemeta($patt) . '\b';
-            push @matches, [ $patt, $1, int($score) ] if $text =~ m/($re)/i;
+            push @matches, [ Encode::encode($enc, $patt),
+                             Encode::encode($enc, $1), int($score) ]
+                if $text =~ m/($re)/;
         }
     }
     @matches;
