diff --git a/SuperScriptViewer/CustomConfig.py b/SuperScriptViewer/CustomConfig.py index 1bde382..df0e4c4 100644 --- a/SuperScriptViewer/CustomConfig.py +++ b/SuperScriptViewer/CustomConfig.py @@ -1,7 +1,10 @@ import locale +# encoding list +# https://docs.python.org/3/library/codecs.html#standard-encodings database_encoding = locale.getpreferredencoding() export_db = "export.db" decorated_db = "decorate.db" env_db = "env.db" -force_regenerate = False \ No newline at end of file +force_regenerate = False + diff --git a/SuperScriptViewer/DecoratorCore.py b/SuperScriptViewer/DecoratorCore.py index 7e82249..099718a 100644 --- a/SuperScriptViewer/DecoratorCore.py +++ b/SuperScriptViewer/DecoratorCore.py @@ -6,7 +6,7 @@ import Progressbar def run(): exportDb = sqlite3.connect(CustomConfig.export_db) - exportDb.text_factory = lambda x: x.decode(CustomConfig.database_encoding) + exportDb.text_factory = lambda x: x.decode(CustomConfig.database_encoding, errors="ignore") decorateDb = sqlite3.connect(CustomConfig.decorated_db) # init table diff --git a/SuperScriptViewer/ServerCore.py b/SuperScriptViewer/ServerCore.py index e28fa88..997ff70 100644 --- a/SuperScriptViewer/ServerCore.py +++ b/SuperScriptViewer/ServerCore.py @@ -26,7 +26,7 @@ def get_env(): env = getattr(g, '_envDatabase', None) if env is None: env = g._envDatabase = sqlite3.connect(CustomConfig.env_db) - env.text_factory = lambda x: x.decode(CustomConfig.database_encoding) + env.text_factory = lambda x: x.decode(CustomConfig.database_encoding, errors="ignore") return env @app.teardown_appcontext @@ -102,7 +102,7 @@ def envQueryHandle(): if fieldLength == 0: cur.execute("SELECT * FROM {}".format(queryTag)) else: - whereStatement = '&&'.join(map(lambda x: "([" + x + "] = ?)", readyData.keys())) + whereStatement = 'AND'.join(map(lambda x: "([" + x + "] = ?)", readyData.keys())) cur.execute("SELECT * FROM {} WHERE ({})".format(queryTag, whereStatement), list(readyData.values())) # iterate diff --git a/SuperScriptViewer/static/env.css b/SuperScriptViewer/static/env.css index e0c4738..17cc198 100644 --- a/SuperScriptViewer/static/env.css +++ b/SuperScriptViewer/static/env.css @@ -3,7 +3,7 @@ table.envOutput { } table.envOutput tr:nth-child(odd) { - background:gray; + background:#cfcfcf; } table.envOutput tr:nth-child(2n) {