This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: more email ASCII decoding errors
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, jasonrm
Priority: normal Keywords:

Created on 2002-12-03 23:44 by jasonrm, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
traceback.txt jasonrm, 2002-12-03 23:45
tmda-mess.txt jasonrm, 2002-12-03 23:46
648119.txt barry, 2002-12-30 18:43
Messages (4)
msg13530 - (view) Author: Jason R. Mastaler (jasonrm) Date: 2002-12-03 23:44
email package v2.4.3.

A similar problem was reported and fixed in
http://python.org/sf/621457

The problem is that when using the Header.Header
class to create a header, and the header value
contains non-ASCII data that can't be decoded,
a UnicodeError is raised.

This is a problem when using email to process
SPAM (as I do in TMDA), as SPAM often does 
contain random non-ASCII data in its headers.

Some way of handling these cases more 
gracefully, without provoking a UnicodeError is 
necessary.

See the attached traceback.txt for an example.
The tmda-mess.txt file referenced from traceback.txt 
is also attached in case you want to reproduce
the problem.
msg13531 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-12-30 18:33
Logged In: YES 
user_id=12800

Matthew's suggestion was to expose the `errors' argument to
the unicode() builtin in Header.__init__() and .append().

I think that's the best we can do.  I'll work out a patch
for email 2.5 (Python 2.3a1).
msg13532 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-12-30 18:43
Logged In: YES 
user_id=12800

What do you think about this patch...
msg13533 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-12-30 19:14
Logged In: YES 
user_id=12800

Applied
History
Date User Action Args
2022-04-10 16:05:57adminsetgithub: 37566
2002-12-03 23:44:59jasonrmcreate