Bugs item #826756, was opened at 2003-10-20 20:23
Message generated for change (Comment added) made by bbaetz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=826756&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Matthias Pronk (mjepronk)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email/Generator.py: Incorrect header output

Initial Comment:
I've found a small bug when using the email/Parser.py
classes. When there is a long "Subject" header, it will
be wrapped to multiple lines, which are preceded by a
tab. This is undesired behaviour, because e-mail
clients show this tab in the subject. Especially,
Mozilla for Windows shows a strange square symbol. The
following code in email/Generator.py (line 180)
resolves the problem:

            else:
                # Header's got lots of smarts, so use it.
                if h.lower() == 'subject':
                    cont_ws = ' ' 
                else:
                    cont_ws = '\t'
                print >> self._fp, Header(
                    v, maxlinelen=self.__maxheaderlen,
                    header_name=h,
continuation_ws=cont_ws).encode()

For more information you can e-mail me: matthias -at-
rubberbiscuit.nl

----------------------------------------------------------------------

Comment By: Bradley Baetz (bbaetz)
Date: 2006-03-30 18:52

Message:
Logged In: YES 
user_id=495627

I disagree that this follows RFC2822. The RFC says:

   The process of moving from this folded multiple-line
representation
   of a header field to its single line representation is called
   "unfolding". Unfolding is accomplished by simply removing
any CRLF
   that is immediately followed by WSP.  Each header field
should be
   treated in its unfolded form for further syntactic and
semantic
   evaluation.

This means that if python takes a header:

Subject: This is a long string

and wraps it to:

Subject: This is a\r\n\tlong string

then when the MUA "simply remov[es] any CRLF" the
whitespace, and we end up with:

Subject: This is a\tlong string

with a tab rather than a space, which doesn't look too good.
Some MUAs condense any following WSP into a single space,
but thats technically breaking the RFC.

(This affects mailman -
http://mail.python.org/pipermail/mailman-developers/2005-December/018410.html)

----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-11-22 05:38

Message:
Logged In: YES 
user_id=12800

RFC 2822 specifies when and how long headers are supposed to
be wrapped, and the default Generator behavior is to be
compliant with this standard.  I consider it a bug in your
mail reader that such long headers are displayed incorrectly
(other mail readers display long wrapped headers correctly).

Having said this, you have options.  You can disable
wrapping altogether by passing maxheaderlen=0 to the
Generator constructor, or you can create a Generator
subclass which overrides the _write_headers() method and
passes a different value for continuation_ws.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=826756&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to