mirror of
https://github.com/django/django.git
synced 2025-09-21 18:00:45 +00:00
Fix #21185: Added tests for unescape_entities.
Also fixed a py3 incompatibility. Thanks to brutasse for the report.
This commit is contained in:
parent
90cd676d29
commit
3754f4ad41
2 changed files with 15 additions and 2 deletions
|
@ -365,12 +365,12 @@ def _replace_entity(match):
|
|||
c = int(text[1:], 16)
|
||||
else:
|
||||
c = int(text)
|
||||
return unichr(c)
|
||||
return six.unichr(c)
|
||||
except ValueError:
|
||||
return match.group(0)
|
||||
else:
|
||||
try:
|
||||
return unichr(html_entities.name2codepoint[text])
|
||||
return six.unichr(html_entities.name2codepoint[text])
|
||||
except (ValueError, KeyError):
|
||||
return match.group(0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue