From 861706fb31c139d53680e69e3acd5655be62ef99 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 2 Nov 2010 18:01:10 +0000 Subject: [PATCH] fix for bug reported by ToR (unknown charset 'utf-8, text/html') --- doc/THANKS | 3 +++ lib/request/basic.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/THANKS b/doc/THANKS index 68d153ef2..20b15198e 100644 --- a/doc/THANKS +++ b/doc/THANKS @@ -422,6 +422,9 @@ Stuffe Sylphid for suggesting some features +ToR + for reporting a minor bug + == Organizations == Black Hat team diff --git a/lib/request/basic.py b/lib/request/basic.py index 681bd228b..ae8559f67 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -81,8 +81,9 @@ def checkCharEncoding(encoding): #http://www.destructor.de/charsets/index.htm translate = { 'windows-874':'iso-8859-11' } - if ';' in encoding: - encoding = encoding[:encoding.find(';')] + for delimiter in (';', ','): + if delimiter in encoding: + encoding = encoding[:encoding.find(delimiter)] # http://philip.html5.org/data/charsets-2.html if encoding in translate: @@ -97,9 +98,9 @@ def checkCharEncoding(encoding): except LookupError: warnMsg = "unknown charset '%s'. " % encoding warnMsg += "Please report by e-mail to sqlmap-users@lists.sourceforge.net." - logger.warn(warnMsg) encoding = conf.dataEncoding + return encoding def decodePage(page, contentEncoding, contentType):