On Tue, 11 Jun 2002 [EMAIL PROTECTED] wrote: > Hi, > > we had a similar problem with Outlook > try the following: > > print list[1].encode('latin1')
Or, a bit more robust (this approach avoids problems with characters which won't fit in Latin1): #---------------------------------------------------------------------- # Convert unicode string to latin-1 encoding. #---------------------------------------------------------------------- import re decodePattern = re.compile(u"([\u0100-\uffff])") def unicodeToLatin1(s): return re.sub(decodePattern, lambda match: u"&#x%X;" % ord(match.group(0)[0]), s).encode('latin-1') print unicodeToLatin1(list[1]) -- Bob Kline mailto:[EMAIL PROTECTED] http://www.rksystems.com _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython