Barry Warsaw writes: > Header wrapping sucks even more because it's supposed to take the > semantic context into account, which means that a generic Header > wrapping algorithm cannot work for everything. E.g. Received: > headers are supposed to wrap after the semicolon.
Received headers are an easy special case: An Internet mail program MUST NOT change or delete a Received: line that was previously added to the message header section. (RFC 5321, sec. 4.4) So you save them as bytes and Barry's your FLUFL, as they say. If email wants to *produce* them (as a service to say smtplib), then it wants to comply with the detailed recommendations in RFC 5321, sec. 4.4 anyway; I don't think there's a good reason treat Received headers as text since they're conceptually part of the wire protocol. (Except for the information of curious users, but then getting it exactly right is best done by just passing the whole thing, folds and all, to .decode('ascii'), I should think.) I should think you *want* addresses and suchlike structured headers (Content-Type with several RFC 2231 parameters, anyone?) to line up nicely, too. So generic folding algorithms are really only applicable to unstructured text fields like Subject and Summary anyway. You can call that "sucky" if you like, I prefer to call it "tasteful." <wink> _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com