[Python-bugs-list] [ python-Feature Requests-724459 ] Add documentation about line endings in email messages.

SourceForge.net noreply@sourceforge.net
Sat, 19 Apr 2003 20:57:55 -0700


Feature Requests item #724459, was opened at 2003-04-19 22:38
Message generated for change (Comment added) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=724459&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tony Meyer (anadelonbrin)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: Add documentation about line endings in email messages.

Initial Comment:
This follows from recent discussion on the spambayes 
mailing list (some of which was also on the mimelib-
devel list) about what character(s) should be used for 
line endings internally and when transmitted.  There is a 
consensus (I think) that the platform/language specific 
character(s) should be used internally, but any module 
that transmits the date should be responsible for 
converting this to the appropriate character(s) - for 
RFC2822/822 this means that all line endings *must* be 
\r\n.

smtplib currently does this, but imaplib doesn't (a bug 
has been posted about this).

To help people understand what the rules are, it would 
be nice if documentation could be added about this - 
especially for anyone developing a new module (like 
smtplib or imaplib) that transmits the data.  The 
following is from a post to the spambayes list from Paul 
Moore, which sounds good to me.  (Where it gets added 
is your problem ;)

"As a general set of rules (which aren't stated anywhere) 
it's probably fair to say that:

   1. Modules which manipulate internet-format data (like 
email) should work with line terminators of \n internally 
(just like Python strings do).
   2. Modules which transmit files across TCP/IP should 
canonicalise any form of line ending to CRLF.
   3. Modules which present data *received* from TCP/IP 
(like POP3) should convert data to \n line endings before 
returning it to the program.
   4. Reading from the filesystem should be handled like 
(3), and should support files opened in text or binary 
modes (or universal newline mode in Python 2.3)
   5. Writing to the filesystem should be done by 
assuming the data uses \n internally (the above rules 
make this true) and writing either in binary format (which 
leaves LFs in the files, ie Unix format) or in text format 
(which converts the \n characters to the platform native 
newline sequence)."

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

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-04-19 23:57

Message:
Logged In: YES 
user_id=12800

Self-assigning

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=724459&group_id=5470