fixing decodeHtml

This commit is contained in:
Rolux 2008-05-08 09:02:51 +02:00
parent dc56e05b3f
commit 0a4acbc2f9

View file

@ -138,9 +138,9 @@ def decodeHtml(html):
>>> decodeHtml('me & you and $&%')
u'me & you and $&%'
"""
if type(text) != unicode:
text = unicode(text)[:]
if type(text) is unicode:
if type(html) != unicode:
html = unicode(html)[:]
if type(html) is unicode:
uchr = unichr
else:
uchr = lambda value: value > 255 and unichr(value) or chr(value)
@ -154,7 +154,7 @@ def decodeHtml(html):
return uchr(name2codepoint[entity])
else:
return match.group(0)
return charrefpat.sub(entitydecode, text).replace(u'\xa0', ' ')
return charrefpat.sub(entitydecode, html).replace(u'\xa0', ' ')
def highlight(text, query, hlClass="hl"):
"""