This commit is contained in:
Miroslav Stampar 2016-01-08 11:47:12 +01:00
parent b427f6c03e
commit e3650342bd
2 changed files with 2 additions and 5 deletions

View File

@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
import base64 import base64
import json import json
import pickle import pickle
import re
import StringIO import StringIO
import sys import sys
import types import types
@ -159,6 +160,7 @@ def htmlunescape(value):
if value and isinstance(value, basestring): if value and isinstance(value, basestring):
codes = (('&lt;', '<'), ('&gt;', '>'), ('&quot;', '"'), ('&nbsp;', ' '), ('&amp;', '&')) codes = (('&lt;', '<'), ('&gt;', '>'), ('&quot;', '"'), ('&nbsp;', ' '), ('&amp;', '&'))
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal) 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)
return retVal return retVal
def singleTimeWarnMessage(message): # Cross-linked function def singleTimeWarnMessage(message): # Cross-linked function

View File

@ -197,11 +197,6 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
_ = "%s(?P<result>.*?)%s" % (kb.chars.start, kb.chars.stop) _ = "%s(?P<result>.*?)%s" % (kb.chars.start, kb.chars.stop)
retVal = extractRegexResult(_, retVal, re.DOTALL | re.IGNORECASE) or retVal retVal = extractRegexResult(_, retVal, re.DOTALL | re.IGNORECASE) or retVal
try:
retVal = re.sub(r"&#x([^;]+);", lambda match: chr(int(match.group(1), 16)), retVal)
except ValueError:
pass
return safecharencode(retVal) if kb.safeCharEncode else retVal return safecharencode(retVal) if kb.safeCharEncode else retVal
def _errorFields(expression, expressionFields, expressionFieldsList, num=None, emptyFields=None, suppressOutput=False): def _errorFields(expression, expressionFields, expressionFieldsList, num=None, emptyFields=None, suppressOutput=False):