Skip to content

Commit fccd697

Browse files
committed
Update for an Issue sqlmapproject#111
1 parent ab9cb80 commit fccd697

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/request/basic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,17 @@ def decodePage(page, contentEncoding, contentType):
211211

212212
# can't do for all responses because we need to support binary files too
213213
if contentType and not isinstance(page, unicode) and any(map(lambda x: x in contentType.lower(), ("text/txt", "text/raw", "text/html", "text/xml"))):
214+
# e.g. Ãëàâà
214215
if "&#" in page:
215-
page = re.sub('&#(\d+);', lambda _: chr(int(_.group(1))), page)
216+
page = re.sub('&#(\d+);', lambda _: chr(int(_.group(1))) if int(_.group(1)) < 256 else _.group(0), page)
217+
216218
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
217219
page = getUnicode(page, kb.pageEncoding)
218220

221+
# e.g. &#8217;&#8230;&#8482;
222+
if "&#" in page:
223+
page = re.sub('&#(\d+);', lambda _: unichr(int(_.group(1))), page)
224+
219225
return page
220226

221227
def processResponse(page, responseHeaders):

0 commit comments

Comments
 (0)