IMAP UTF-7, any codec for that anywhere?

Max M maxm at mxm.dk
Wed Dec 1 10:35:59 CET 2004


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'

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the Python-list mailing list