pst: account for possible failure in decoding body and possible "unicode" name for encoding
This commit is contained in:
parent
1f92478daf
commit
1d158f329a
@ -135,8 +135,13 @@ class EmailBuilder(object):
|
||||
charset = headers.get_content_charset()
|
||||
body = ''
|
||||
if charset:
|
||||
body = self.body.decode(charset, errors='replace')
|
||||
#self.log("DECODE FROM HEADER CHARSET %s SUCCEEDED"% charset)
|
||||
if charset == 'unicode':
|
||||
charset = 'utf-16'
|
||||
try:
|
||||
body = self.body.decode(charset, errors='replace')
|
||||
#self.log("DECODE FROM HEADER CHARSET %s SUCCEEDED"% charset)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
body = self.body.decode('utf-8')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user