Roundup Tracker - Issues


Author ezio.melotti
Recipients ezio.melotti
Date 2018-10-10.01:07:52
Message-id <>
RoundupMessage._decode_header (formerly known as
Message._decode_header_to_utf8) is incorrect when the encoding is missing:

    def _decode_header(self, hdr):
        parts = []
        for part, encoding in decode_header(hdr):
            if encoding:
                part = part.decode(encoding)
        return ''.join([u2s(p) for p in parts])

If the encoding is specified, the parts will be decoded to a list of
unicode strings, if it isn't, parts will be a list of byte strings.  In
the latter case, u2s() will fail to encode the byte strings on Python 2
if they contain non-ascii characters, and it will always fail on Python
3 since byte strings don't have an .encode() method.

I fixed this downstream by attempting the decoding using utf-8 first and
falling back on iso-8859-1 if that fails:

The code on 1.5 is slightly different, but the logic is the same.
Date User Action Args
2018-10-10 01:07:54ezio.melottisetrecipients: + ezio.melotti
2018-10-10 01:07:54ezio.melottisetmessageid: <>
2018-10-10 01:07:54ezio.melottilinkissue2551008 messages
2018-10-10 01:07:53ezio.melotticreate