[Mailman-Developers] [PATCH] Fix endless prefix adding with q-p/base64 Subject lines

Mikhail Zabaluev mhz@alt-linux.org
Mon, 8 Apr 2002 14:22:12 +0400


Hello Ben,

On Mon, Apr 08, 2002 at 06:44:40PM +0900, Ben Gertzfield wrote:
>
> On Monday, April 8, 2002, at 06:41 , Mikhail Zabaluev wrote:
> 
> >Broad assumptions stink :)
> >Why not Unicode, however? It would be nice if email.Header.Header
> >objects would dump themselves into Unicode strings, so that we
> >can match regex there without hassle. See my feature request
> >at SF for mimelib.
> 
> That will work for encodings that Python happens to have a Unicode codec 
> installed for, but certainly not for all encodings.  Also, we will lose 
> information if we try to take the Unicode header and make a non-Unicode 
> header out of it again (if that's even possible!).. not all mail clients 
> support UTF-8 headers yet, especially Unix ones.

In our case, there is no need to re-encode text back from Unicode.
We: 1) get the Subject: value in Unicode; 2) search for the prefix;
3) append the prefix (probably as an encoded word) to the _original_
encoded value, in case the prefix is not found.

> I think I need to do a thorough revamping of the email.Charset and 
> email.Header modules to be a bit more Unicode-friendly (they are 
> Unicode-friendly now, but don't really spit out Unicode too easily).

I noticed that the last two optional parameters to the
email.Header.Header constructor are in fact mutually exclusive.
Wouldn't it be better to have them as named parameters?  Another named
parameter, 'encoded', would hint that the string parameter needs to be
parsed as a MIME-encoded header (no charset can be specified
in this case).

-- 
Stay tuned,
  MhZ                                     JID: mookid@jabber.org
___________
There is no royal road to geometry.
		-- Euclid