You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/06 12:12:07 UTC

[incubator-ponymail-foal] 01/02: Elaborate on message body encoding hack.

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

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

commit bd17e22b0b9030d2736bb8759f0a7e4414d85773
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Sep 6 14:10:16 2020 +0200

    Elaborate on message body encoding hack.
---
 tools/archiver.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index 285032c..8148e54 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -201,9 +201,11 @@ class Body:
                     if valid_encodings:
                         self.character_set = "us-ascii"
                 except UnicodeDecodeError:
-                    # If us-ascii strict fails, it's probably undeclared UTF-8.
+                    # If us-ascii strict fails, it's probably undeclared UTF-8 (it happens!).
                     # Set the .string, but not a character set, as we don't know it for sure.
-                    # This is mainly so the older generators won't barf.
+                    # This is mainly so the older generators won't barf, as the generator will
+                    # be fed the message body as a bytes object if no encoding is set, while
+                    # the resulting metadoc will always use the string version.
                     self.string = self.bytes.decode("utf-8", "replace")
 
     def __repr__(self):