ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [incubator-ponymail] branch master updated: Document behaviour and issue
Date Fri, 25 May 2018 16:38:59 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new 12c3f23  Document behaviour and issue
12c3f23 is described below

commit 12c3f23736977885683adfbe24477693e0a1cc89
Author: Sebb <sebb@apache.org>
AuthorDate: Fri May 25 17:38:57 2018 +0100

    Document behaviour and issue
---
 tools/archiver.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index e859bd8..0416cee 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -253,12 +253,17 @@ class Archiver(object): # N.B. Also used by import-mbox.py
         # this requires a GPL lib, user will have to install it themselves
         if firstHTML and (not body or len(body) <= 1 or (iBody and str(body).find(str(iBody))
!= -1)):
             body = self.html2text(firstHTML.decode("utf-8", 'ignore') if type(firstHTML)
is bytes else firstHTML)
-    
+ 
+        # See issue#463
+        # This code will try at most one charset
+        # If the decode fails, it will use utf-8
         for charset in pm_charsets(msg):
             try:
                 body = body.decode(charset) if type(body) is bytes else body
+                # at this point body can no longer be bytes
             except:
                 body = body.decode('utf-8', errors='replace') if type(body) is bytes else
body
+                # at this point body can no longer be bytes
                 
         return body    
 

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.

Mime
View raw message