GitHub user sebbASF opened an issue:

    https://github.com/apache/incubator-ponymail/issues/244

    Bug: archiver.py strange handling of multiple charsets in msgbody() function

    The msgbody function contains the following code:
    ```
    for charset in pm_charsets(msg):
        try:
            body = body.decode(charset) if type(body) is bytes else body
        except:
            body = body.decode('utf-8', errors='replace') if type(body) is 
bytes else body
    ```
    AFAICT this can only ever apply the first charset, because if that fails, 
it will use utf-8, and the type will no longer be bytes.
    
    If the intention was to try to apply charsets until one works, then the 
code is broken.
    
    It's also not clear why it is useful to try all the charsets in the message 
rather that the one that actually applies to the part in question.

----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to