Skip to content

Commit 51bf66f

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent f9fc7b8 commit 51bf66f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Fixed:
1010
- Fix references to the old * Registration Permissions
1111
- Fix missing merge of fix to sf bug 1177057
1212
- Fix RDBMS indexer indexing UTF-8 words that encode to > 30 chars
13+
- Handle invalidly-specified charsets in incoming email
1314

1415

1516
2005-07-18 0.8.4

roundup/mailgw.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.159.2.7 2005-09-26 02:14:07 richard Exp $
75+
$Id: mailgw.py,v 1.159.2.8 2005-09-28 05:49:23 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -223,8 +223,9 @@ def getbody(self):
223223
# Encode message to unicode
224224
charset = rfc2822.unaliasCharset(self.getparam("charset"))
225225
if charset:
226-
# Do conversion only if charset specified
227-
edata = unicode(data, charset).encode('utf-8')
226+
# Do conversion only if charset specified - handle
227+
# badly-specified charsets
228+
edata = unicode(data, charset, 'replace').encode('utf-8')
228229
# Convert from dos eol to unix
229230
edata = edata.replace('\r\n', '\n')
230231
else:

0 commit comments

Comments
 (0)