[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.152,1.153
Tony Meyer
anadelonbrin at users.sourceforge.net
Sat Jun 10 06:57:13 CEST 2006
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30085/Outlook2000
Modified Files:
addin.py
Log Message:
Add simple parts of [ 824651 ] Multibyte (CJK etc.) message support
(Lets extractmessages and scoremsg work with charsets other than us-ascii, and lets Outlook plug-in handle tokens that aren't in the right encodng).
Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** addin.py 22 Apr 2005 06:18:09 -0000 1.152
--- addin.py 10 Jun 2006 04:57:10 -0000 1.153
***************
*** 5,8 ****
--- 5,9 ----
import traceback
import _winreg
+ from types import UnicodeType
# *sigh* - this is for the binary installer, and for the sake of one line
***************
*** 522,526 ****
else:
nham = nspam = "-"
! word = repr(word)
push(escape(word) + " " * (35-len(word)))
push(format % (prob, nham, nspam))
--- 523,530 ----
else:
nham = nspam = "-"
! if isinstance(word, UnicodeType):
! word = word.encode('mbcs', 'replace')
! else:
! word = repr(word)
push(escape(word) + " " * (35-len(word)))
push(format % (prob, nham, nspam))
***************
*** 550,554 ****
# could use pprint, but not worth it.
for token in toks:
! push("<code>" + repr(token) + "</code><br>\n")
# Put the body together, then the rest of the message.
--- 554,562 ----
# could use pprint, but not worth it.
for token in toks:
! if isinstance(token, UnicodeType):
! token = token.encode('mbcs', 'replace')
! else:
! token = repr(token)
! push("<code>" + token + "</code><br>\n")
# Put the body together, then the rest of the message.
More information about the Spambayes-checkins
mailing list