Skip to content

Commit 545b72f

Browse files
author
Richard Jones
committed
Handle invalidly-specified charsets in incoming email
1 parent 5522e8f commit 545b72f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Feature:
1515
Fixed:
1616
- Display of Multilinks where linked Class labelprop values are None
1717
- Fix references to the old * Registration Permissions
18+
- Fix missing merge of fix to sf bug 1177057
19+
- Fix RDBMS indexer indexing UTF-8 words that encode to > 30 chars
20+
- Handle invalidly-specified charsets in incoming email
1821

1922

2023
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.166 2005-06-24 07:16:01 richard Exp $
75+
$Id: mailgw.py,v 1.167 2005-09-28 05:48: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)