Commit d221fc2d authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[py3k] Import name2codepoint from six.moves

Related to #268148.
parent cdaa06f45b89
...@@ -35,10 +35,11 @@ import locale ...@@ -35,10 +35,11 @@ import locale
import mimetypes import mimetypes
import re import re
import string import string
import htmlentitydefs
import codecs import codecs
from io import BytesIO from io import BytesIO
from six.moves.html_entities import name2codepoint
try: try:
import chardet import chardet
except ImportError: except ImportError:
...@@ -144,7 +145,7 @@ def xml_escape(data): ...@@ -144,7 +145,7 @@ def xml_escape(data):
def html_unescape(data): def html_unescape(data):
"""unescapes XML/HTML entities""" """unescapes XML/HTML entities"""
for entityname, codepoint in htmlentitydefs.name2codepoint.iteritems(): for entityname, codepoint in name2codepoint.items():
data = data.replace('&%s;' % entityname, unichr(codepoint)) data = data.replace('&%s;' % entityname, unichr(codepoint))
return data.replace(''', "'") return data.replace(''', "'")
......
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