This commit is contained in:
Kovid Goyal 2008-05-30 09:22:24 -07:00
parent b13d51c837
commit 207f7b6b8d

View File

@ -590,7 +590,10 @@ def entity_to_unicode(match, exceptions=[], encoding='cp1252'):
return unichr(num)
return chr(num).decode(encoding)
if ent.startswith(u'#'):
num = int(ent[1:])
try:
num = int(ent[1:])
except ValueError:
return '&'+ent+';'
if encoding is None or num > 255:
return unichr(num)
try: