On Wed, 01 Dec 2004 10:35:59 +0100, Max M <[EMAIL PROTECTED]> wrote: >Brian Quinlan wrote: > > Max M wrote: > > > >> Is there any codec available for handling The special UTF-7 codec for > >> IMAP? > > > Is there something special do you need or is recipe OK? > > > > >>> u"\u00ff".encode('utf-7') > > '+AP8-' > > > A recipe would be excellent. Unfortunately yours is no right. It should > have looke like: > > >>> imapUTF7Encode(u"\u00ff") > '&AP8-' > > I believe you missed the 'special' in "The special UTF-7 codec for IMAP?" > > Imap folders use a non-standard version of utf-7, where some characters > are different. > > I found som messages from 2001 on the net between a few Python unicode > developers, where they discuss implementing it. But I cannot find an > implementation anywhere. > > I found a perl module that converts to/from the codec, but as usual that > is regex hell. Well ok its not that difficult, but I still need to think > to hard to parse Perl regex'
Twisted's IMAP4 support includes an implementation of this codec. Most of the API also happily accepts unicode objects and encodes them as necessary, too. http://www.twistedmatrix.com/ Jp -- http://mail.python.org/mailman/listinfo/python-list