File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3365,6 +3365,27 @@ def checkDeprecatedOptions(args):
33653365 errMsg += " (hint: %s)" % DEPRECATED_OPTIONS [_ ]
33663366 raise SqlmapSyntaxException (errMsg )
33673367
3368+ def checkSystemEncoding ():
3369+ """
3370+ Checks for problematic encodings
3371+ """
3372+
3373+ if sys .getdefaultencoding () == "cp720" :
3374+ try :
3375+ codecs .lookup ("cp720" )
3376+ except LookupError :
3377+ errMsg = "there is a known Python issue (#1616979) related "
3378+ errMsg += "to support for charset 'cp720'. Please visit "
3379+ errMsg += "'http://blog.oneortheother.info/tip/python-fix-cp720-encoding/index.html' "
3380+ errMsg += "and follow the instructions to be able to fix it"
3381+ logger .critical (errMsg )
3382+
3383+ warnMsg = "temporary switching to charset 'cp1256'"
3384+ logger .warn (warnMsg )
3385+
3386+ reload (sys )
3387+ sys .setdefaultencoding ("cp1256" )
3388+
33683389def evaluateCode (code , variables = None ):
33693390 """
33703391 Executes given python code given in a string form
Original file line number Diff line number Diff line change 55See the file 'doc/COPYING' for copying permission
66"""
77
8+ import codecs
89import sys
910
1011from optparse import OptionError
1314from optparse import SUPPRESS_HELP
1415
1516from lib .core .common import checkDeprecatedOptions
17+ from lib .core .common import checkSystemEncoding
1618from lib .core .common import expandMnemonics
1719from lib .core .common import getUnicode
1820from lib .core .data import logger
@@ -28,6 +30,8 @@ def cmdLineParser():
2830 This function parses the command line parameters and arguments
2931 """
3032
33+ checkSystemEncoding ()
34+
3135 usage = "%s%s [options]" % ("python " if not IS_WIN else "" , \
3236 "\" %s\" " % sys .argv [0 ] if " " in sys .argv [0 ] else sys .argv [0 ])
3337
You can’t perform that action at this time.
0 commit comments