Steven D'Aprano wrote:
> I have a string containing Latin-1 characters:
> 
> s = u"© and many more..."
> 
> I want to convert it to HTML entities:
> 
> result =>
> "© and many more..."
> 
> Decimal/hex escapes would be acceptable:
> "© and many more..."
> "© and many more..."

 >>> s = u"© and many more..."
 >>> s.encode('ascii', 'xmlcharrefreplace')
'© and many more...'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to