Update of /cvsroot/mailman/mailman/Mailman/Handlers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21380
Modified Files:
Tag: Release_2_1-maint
ToDigest.py
Log Message:
Fix for unknown/malicious charset value.
Index: ToDigest.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/ToDigest.py,v
retrieving revision 2.22.2.8
retrieving revision 2.22.2.9
diff -u -d -r2.22.2.8 -r2.22.2.9
--- ToDigest.py 19 Oct 2004 04:34:06 -0000 2.22.2.8
+++ ToDigest.py 11 Dec 2004 00:27:04 -0000 2.22.2.9
@@ -141,7 +141,7 @@
# Prepare common information (first lang/charset)
lang = mlist.preferred_language
lcset = Utils.GetCharSet(lang)
- lcset_out = Charset(lcset).output_charset
+ lcset_out = Charset(lcset).output_charset or lcset
# Common Information (contd)
realname = mlist.real_name
volume = mlist.volume
@@ -321,8 +321,14 @@
or msg.as_string().split('\n\n',1)[1]
mcset = msg.get_content_charset('')
if mcset and mcset <> lcset and mcset <> lcset_out:
- payload = unicode(payload, mcset, 'replace'
- ).encode(lcset, 'replace')
+ try:
+ payload = unicode(payload, mcset, 'replace'
+ ).encode(lcset, 'replace')
+ except LookupError:
+ # TK: Message has something unknown charset.
+ # _out means charset in 'outer world'.
+ payload = unicode(payload, lcset_out, 'replace'
+ ).encode(lcset, 'replace')
print >> plainmsg, payload
if not payload.endswith('\n'):
print >> plainmsg
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org