summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>2006-11-10 12:37:18 +0100
committerAlexandre Fayolle <alexandre.fayolle@logilab.fr>2006-11-10 12:37:18 +0100
commit2e503d70d3348a7f587c843f7b3e2de003c769e7 (patch)
treef62bfb1458c87aaac6aa37131324202b5b5672c0
parenta2a0e35a6ccdf63efe95a1ca6d179c335e13b718 (diff)
downloadlogilab-common-2e503d70d3348a7f587c843f7b3e2de003c769e7.tar.gz
use 'replace' as error manager for unicode() constructor in umessage
-rw-r--r--umessage.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/umessage.py b/umessage.py
index a42cb40..3bf92e4 100644
--- a/umessage.py
+++ b/umessage.py
@@ -11,7 +11,7 @@ def decode_QP(string):
for decoded, charset in decode_header(string):
if charset is None:
charset = 'iso-8859-15'
- parts.append(unicode(decoded, charset))
+ parts.append(unicode(decoded, charset, 'replace'))
return u' '.join(parts)
@@ -47,7 +47,7 @@ class UMessage:
return [UMessage(msg) for msg in payload]
if message.get_content_maintype() != 'text':
return payload
- return unicode(payload or '', message.get_charset() or 'iso-8859-15')
+ return unicode(payload or '', message.get_charset() or 'iso-8859-15', 'replace')
else:
payload = UMessage(message.get_payload(index, decode))
return payload