UTF8 & HTMLParser
Klaus Alexander Seistrup
klaus at seistrup.dk
Fri Dec 1 00:03:28 EST 2006
Jan Danielsson wrote:
> However, I would like to convert the "text" (which is utf8)
> to latin-1. How do I do that?
How about:
latin = unicode(text, 'utf-8').encode('iso-8859-1')
Please see help(u''.encode) for details about error handling. You
might also want to trap errors in a try-except statement.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
More information about the Python-list
mailing list