Issue 1086: test_email failed - Python tracker (original) (raw)
test test_email failed -- Traceback (most recent call last): File "/home/xyb/Python-3.0a1/Lib/email/test/test_email.py", line 1445, in test_same_boundary_inner_outer msg = self._msgobj('msg_15.txt') File "/home/xyb/Python-3.0a1/Lib/email/test/test_email.py", line 67, in _msgobj return email.message_from_file(fp) File "/home/xyb/Python-3.0a1/Lib/email/init.py", line 46, in message_from_file return Parser(*args, **kws).parse(fp) File "/home/xyb/Python-3.0a1/Lib/email/parser.py", line 68, in parse data = fp.read(8192) File "/home/xyb/Python-3.0a1/Lib/io.py", line 1231, in read readahead, pending = self._read_chunk() File "/home/xyb/Python-3.0a1/Lib/io.py", line 1127, in _read_chunk pending = self._decoder.decode(readahead, not readahead) File "/home/xyb/Python-3.0a1/Lib/codecs.py", line 291, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec can't decode byte 0xbe in position 86: unexpected code byte
I don't think recoding the message is the right thing to do. Instead, the email package should be fixed to not treat the bytes before the first part of a multipart message as text, or else assume that it is Latin-1 encoded (it's certainly not meant to be text to be shown to the user - it's a fallback for MUAs which don't support MIME (whether it then is a smart thing to Danish with Latin-1 is a different question))