diff --git a/lib/core/convert.py b/lib/core/convert.py index 00db9fea1..dbcbb233b 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -160,7 +160,10 @@ def htmlunescape(value): if value and isinstance(value, basestring): codes = (('<', '<'), ('>', '>'), ('"', '"'), (' ', ' '), ('&', '&')) retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal) - retVal = re.sub(r"&#x([^;]+);", lambda match: chr(int(match.group(1), 16)), retVal) + try: + retVal = re.sub(r"&#x([^;]+);", lambda match: unichr(int(match.group(1), 16)), retVal) + except ValueError: + pass return retVal def singleTimeWarnMessage(message): # Cross-linked function