Decoding 'funky' e-mail subjects
Jonas Galvez
jg at jonasgalvez.com
Tue Jun 8 08:38:22 EDT 2004
Paul Rubin wrote:
> A lot of those funny subjects come from spammers. Never eval
> anything from anyone like that!!!
Hi Paul, yeah, actually, that kind of 'funky' subject is very common
on mailing-lists here in Brazil (where ISO-8859-1 is the standard). A
lot of people use crappy webmail software which spills out that kind
of mess. So I'm forced to deal with it :-)
By the way, this is for a mail2rss application which will enable easy
removal/blacklisting of spam, among other things.
Christos TZOTZIOY Georgiou wrote:
> A sound advice by Paul. However, lots of those funny subjects come
> in legitimate e-mails from countries where the ascii range is not
> enough. So, a safer alternative to the code above is:
>
> try: return string.atoi(str, 16)
> except: return '?'
> # int(s, base) was not available in 1.5.2
Thanks! Yeah, I tried using int(str, base) on Python 1.5.2, and I was
too lazy to look for the alternative when I was able to do that quick
and dirty eval() thingy :-)
\\ jonas galvez
// jonasgalvez.com
More information about the Python-list
mailing list