diff roundup/mailgw.py @ 3416:f9279aaa346c maint-0.8

merge from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Wed, 28 Sep 2005 05:49:23 +0000
parents aaf00739eb96
children 3089c7f4a8b8
line wrap: on
line diff
--- a/roundup/mailgw.py	Wed Sep 28 05:41:19 2005 +0000
+++ b/roundup/mailgw.py	Wed Sep 28 05:49:23 2005 +0000
@@ -72,7 +72,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception.
 
-$Id: mailgw.py,v 1.159.2.7 2005-09-26 02:14:07 richard Exp $
+$Id: mailgw.py,v 1.159.2.8 2005-09-28 05:49:23 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -223,8 +223,9 @@
         # Encode message to unicode
         charset = rfc2822.unaliasCharset(self.getparam("charset"))
         if charset:
-            # Do conversion only if charset specified
-            edata = unicode(data, charset).encode('utf-8')
+            # Do conversion only if charset specified - handle
+            # badly-specified charsets
+            edata = unicode(data, charset, 'replace').encode('utf-8')
             # Convert from dos eol to unix
             edata = edata.replace('\r\n', '\n')
         else:

Roundup Issue Tracker: http://roundup-tracker.org/