Commit d77d0351 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

here, the output should be unicode not str. this part is only called in...

here, the output should be unicode not str. this part is only called in python-2.4, because python-2.6's HTMLParser.unescape() already decode such entities.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41868 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d67c6d84
...@@ -117,13 +117,12 @@ def decode_htmlentities(s): ...@@ -117,13 +117,12 @@ def decode_htmlentities(s):
def decode_htmlentity(m): def decode_htmlentity(m):
entity_value = m.groupdict()['htmlentity'] entity_value = m.groupdict()['htmlentity']
if entity_value.lower().startswith('x'):
try:
return chr(int('0'+entity_value,16))
except ValueError:
return entity_value
try: try:
return chr(int(entity_value)) if entity_value[0] in ['x','X']:
c = int(entity_value[1:], 16)
else:
c = int(entity_value)
return unichr(c)
except ValueError: except ValueError:
return entity_value return entity_value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment