Replace html entities with the corresponding utf-8 characters in Python 2.6

Modern Python 3 approach:

>>> import html
>>> html.unescape('© €')
© €

https://docs.python.org/3/library/html.html


Python >= 3.4

Official documentation for HTMLParser: Python 3

>>> from html import unescape
>>> unescape('© €')
© €

Python < 3.5

Official documentation for HTMLParser: Python 3

>>> from html.parser import HTMLParser
>>> pars = HTMLParser()
>>> pars.unescape('&copy; &euro;')
© €

Note: this was deprecated in the favor of html.unescape().

Python 2.7

Official documentation for HTMLParser: Python 2.7

>>> import HTMLParser
>>> pars = HTMLParser.HTMLParser()
>>> pars.unescape('&copy; &euro;')
u'\xa9 \u20ac'
>>> print _
© €