Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de06ae6

Browse files
committed
Fixes #1647
1 parent c7ea3d6 commit de06ae6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/core/convert.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ def htmlunescape(value):
160160
if value and isinstance(value, basestring):
161161
codes = (('&lt;', '<'), ('&gt;', '>'), ('&quot;', '"'), ('&nbsp;', ' '), ('&amp;', '&'))
162162
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal)
163-
retVal = re.sub(r"&#x([^;]+);", lambda match: chr(int(match.group(1), 16)), retVal)
163+
try:
164+
retVal = re.sub(r"&#x([^;]+);", lambda match: unichr(int(match.group(1), 16)), retVal)
165+
except ValueError:
166+
pass
164167
return retVal
165168

166169
def singleTimeWarnMessage(message): # Cross-linked function

0 commit comments

Comments
 (0)