[Spambayes-checkins] spambayes/spambayes message.py,1.41,1.42

Tony Meyer anadelonbrin at users.sourceforge.net
Tue Nov 25 19:34:34 EST 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv4950/spambayes

Modified Files:
	message.py 
Log Message:
Encode words in the evidence header as utf-8 if they are unicode.

Part of patch [ 824651 ] Japanese (and/or other CJK languages) message support

Index: message.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** message.py	25 Nov 2003 23:11:18 -0000	1.41
--- message.py	26 Nov 2003 00:34:32 -0000	1.42
***************
*** 101,104 ****
--- 101,105 ----
  import email.Message
  import email.Parser
+ import email.Header
  
  from spambayes import dbmstorage
***************
*** 363,366 ****
--- 364,370 ----
              for word, score in clues:
                  if (word[0] == '*' or score <= hco or score >= sco):
+                     if isinstance(word, types.UnicodeType):
+                         word = email.Header.Header(word,
+                                                    charset='utf-8').encode()
                      evd.append("%r: %.2f" % (word, score))
  





More information about the Spambayes-checkins mailing list