[Email-SIG] email.header.decode_header eats my spaces

Jasper Spaans jasper at vs19.net
Tue Mar 27 01:39:13 CEST 2007


Hello SIG,

Today I was playing around with the decode_header function of the  
email.header module, and it is eating my spaces.
Some people have filed bugs about this [1] [2] and have proposed the  
following patch, which to me seems to be obviously correct:

etchy:/usr/lib/python2.5/email# diff -u header.py{~,}
--- header.py~  2007-03-27 01:10:31.000000000 +0200
+++ header.py   2007-03-27 01:10:31.000000000 +0200
@@ -77,7 +77,7 @@
              continue
          parts = ecre.split(line)
          while parts:
-            unenc = parts.pop(0).strip()
+            unenc = parts.pop(0).rstrip()
              if unenc:
                  # Should we continue a long line?
                  if decoded and decoded[-1][1] is None:

(Doing a test-run on a corpus of about 23k messages posted to a  
public mailing list with these two variants shows that several (imho)  
bugs dissappear and no new bugs appear; typical example:
-RenéPfeiffer <> vs =?utf-8?B?UmVuw6k=?= Pfeiffer <>
+René Pfeiffer <> vs =?utf-8?B?UmVuw6k=?= Pfeiffer <>
)

Is there any reason for this not to be incorporated into the package?

Cheers,

Jasper

[1] http://aspn.activestate.com/ASPN/Mail/Message/mimelib-devel/1292338
[2] http://sourceforge.net/tracker/index.php? 
func=detail&aid=1467619&group_id=5470&atid=105470

-- 
Jasper Spaans                                       http://jsp.vs19.net/
                This line was last modified 0 seconds ago.





More information about the Email-SIG mailing list