[Patches] [ python-Patches-1681333 ] email.header unicode fix

SourceForge.net noreply at sourceforge.net
Fri Mar 16 03:01:12 CET 2007


Patches item #1681333, was opened at 2007-03-15 11:13
Message generated for change (Comment added) made by tkikuchi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1681333&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: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tokio Kikuchi (tkikuchi)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email.header unicode fix

Initial Comment:
email.header.Header class has its unicode representation which is slightly different from str representation.

>>> h = email.Header.make_header((('[XXX]', 'us-ascii'), ('Re:', 'us-ascii')))
>>> unicode(h)
u'[XXX]Re:'
>>> str(h)
'[XXX] Re:'

Note that a white space between ']' and 'R' is absent from unicode representation.  A word-separating space should be needed in following contexts:

lastcs \ nextcs | ascii | other |
     ascii      |  sp   |   sp  |
     other      |  sp   | nosp  |

Current code fails to put a space for ascii\ascii case.

Also, if the ascii string has a trailing space, it may result in a extraneous double space which has semantically equivalent to a single space and sometimes annoying.  You should use qp encoding for ascii charset if you insist on the presence of the space.

The patch includes test code. :)


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

>Comment By: Tokio Kikuchi (tkikuchi)
Date: 2007-03-16 02:01

Message:
Logged In: YES 
user_id=67709
Originator: YES

Sorry but I am withdrawing the latter part of the patch for ascii
encoding.  Revised patch is for only unicode representation.

File Added: email_header_unicode.patch

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

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


More information about the Patches mailing list