On Jan 05, Jason Gunthorpe wrote: > It does not decode quoted addresses like: > > Lista Debian =?iso-8859-1?Q?Espa=F1ol?= > <debian-user-spanish@lists.debian.org>
Here's a somewhat ugly solution to this problem; you'll need GNU recode installed: #!/usr/bin/python import popen2, re, string commentpart = 'Lista Debian =?iso-8859-1?Q?Espa=F1ol?=' encodings = {'B':'Base64', 'Q':'QP'} test = re.compile(r'=[?]([^?]+)[?]([BQ])[?]([^?]+)[?]=') newwords = [] for word in string.split(commentpart): mob = test.match(word) if mob: (charset, encoding, body) = mob.groups() (fout, fin) = popen2.popen2('recode %s/%s' % (charset, encodings[encoding])) fin.write(body+'\n') fin.close() newwords.append(fout.readline()[:-1]) else: newwords.append(word) name = string.join(newwords, ' ') print name ## CUT HERE This should work for anything compliant with RFC 1522. Don't hold your breath, though... it is a 20 minute hack. Chris -- ============================================================================= | Chris Lawrence | It's 2/3 of a beltway... | | <[EMAIL PROTECTED]> | http://www.lordsutch.com/tn385/ | | | | | Debian Developer | Join the party that opposed the CDA | | http://www.debian.org/ | http://www.lp.org/ | =============================================================================