Roundup Tracker - Issues

Issue 2551049

classification
Mailer (outgoing) not working with non-ascii content
Type: crash Severity: normal
Components: Mail interface Versions: 2.0.0alpha
process
Status: closed fixed
:
: schlatterbeck : cmeerw, rouilj, schlatterbeck
Priority: :

Created on 2019-07-02 16:14 by schlatterbeck, last changed 2019-07-22 18:06 by schlatterbeck.

Messages
msg6569 Author: [hidden] (schlatterbeck) Date: 2019-07-02 16:14
The mailer currently uses message.set_payload method without a charset
(charset is an optional argument). This results in a traceback with a
decoding error:

Error: 'ascii' codec can't encode character u'\xe4' in position 15:
ordinal not in range(128)

The fix is to pass the configured charset.

Note that I'm using mailer.standard_message explicitly in a reactor and
I'm not sure if normal nosy emails use the same code path.

I'll push a patch but wanted to document this.
msg6570 Author: [hidden] (schlatterbeck) Date: 2019-07-02 16:17
Fixed in commit bd245858c823
msg6571 Author: [hidden] (rouilj) Date: 2019-07-06 01:00
Ralf:

Sorry to report this but the test is breaking the build under python 3.

See:  https://travis-ci.org/roundup-tracker/roundup/builds/554042243

The crash reports:

            return address
        try:
>           encname = b2s(name.encode('ASCII'))
E           AttributeError: 'bytes' object has no attribute 'encode'
roundup/mailer.py:38: AttributeError

I committed a change that did:

   b2s(name).encode('ASCII')

but that broke even more places, so I reverted it.
msg6583 Author: [hidden] (schlatterbeck) Date: 2019-07-22 18:06
Thanks for finding this. The bug is in my (new) test for
mailer.standard_message not in the things it tests.

The roundup mailer interface in python3 uses python strings (unicode)
while python2 uses utf-8. So we get a traceback in python3 when it tries
to *encode* a utf-8 bytes type. The fix is to have the test distinguish
these two cases, looks ugly but I don't think we can avoid the
dependency on the python versions because of the different APIs.

Sorry for not checking if my test passed for py3, I'll try to do that in
the future.

Fix pushed in f767a83a6af0
History
Date User Action Args
2019-07-22 18:06:05schlatterbecksetstatus: open -> closed
messages: + msg6583
2019-07-06 01:00:07rouiljsetstatus: closed -> open
nosy: + rouilj
messages: + msg6571
2019-07-02 16:17:02schlatterbecksetstatus: new -> closed
resolution: fixed
messages: + msg6570
2019-07-02 16:14:52schlatterbeckcreate