This is an automated email from the ASF dual-hosted git repository.

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

commit 1164bf8661232365286dcb27ed157246eb704146
Author: Sebb <s...@apache.org>
AuthorDate: Fri Apr 26 23:40:05 2024 +0100

    Skip bad encoding
---
 tools/archiver.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index 2feb887..89d7af1 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -211,6 +211,9 @@ class Body:
                         break
                     except UnicodeDecodeError:
                         pass
+                    except LookupError:
+                        print("Body detected invalid encoding: %s" % cs)
+                        pass
             # If no character set was defined, the email MUST be US-ASCII by 
RFC822 defaults
             # This isn't always the case, as we're about to discover.
             if not self.string:
@@ -428,7 +431,7 @@ class Archiver(object):  # N.B. Also used by import-mbox.py
                 ):
                     first_html = Body(part)
             except Exception as err:
-                print(err)
+                print("Failed to extract Body: %s" % err)
 
         # this requires a GPL lib, user will have to install it themselves
         if first_html and (

Reply via email to