-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I get a UnicodeDecodeError when REPORT contains a preview in some character set other than UTF-8.
Here's a (slightly doctored) traceback:
test.py: b'SPAMD/1.1 0 EX_OK\r\nContent-length: 3570\r\nSpam: False ; 1.6 / 5.0\r\n\r\nSpam detection software, running on the system "ip-10-9-8-7.eu-west-1.compute.internal",\nhas NOT identified this incoming email as spam. The original\nmessage has been attached to this so you can view it or label\nsimilar future email. If you have any questions, see\nthe administrator of that system for details.\n\nContent preview: \xe7\xb1\x9f\xe6\x95\xa1[...] \n\nContent analysis details: (1.6 points, 5.0 required)\n\n pts rule name description\n---- ---------------------- --------------------------------------------------\n 0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no\n trust\n [59.58.57.56 listed in list.dnswl.org]\n 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail\n domains are different\n'
Traceback (most recent call last):
File "test.py", line 70, in verdicts
return self.analyze(message)
File "scan.py", line 92, in analyze
report = self.spamc.report(message.raw_bytes()[0:self.spamc_maxsize])
File "/Users/tripleee/env/lib/python3.7/site-packages/spamc/client.py", line 323, in report
return self.perform('REPORT', msg)
File "/Users/tripleee/env/lib/python3.7/site-packages/spamc/client.py", line 282, in perform
return get_response(cmd, conn, raw_symbols)
File "/Users/tripleee/env/lib/python3.7/site-packages/spamc/client.py", line 82, in get_response
data = raw.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 446: invalid continuation byte
Metadata
Metadata
Assignees
Labels
No labels