From 7681768ba460c453a765f773851fbb9641aec8b0 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 27 May 2020 20:09:21 +1000 Subject: [PATCH] specify unicode and charset on db connection. idk why i need to do this since my server is configured to use these as the default values but whoooo knows --- app/functions.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/functions.py b/app/functions.py index afd140c..cd1ef73 100644 --- a/app/functions.py +++ b/app/functions.py @@ -46,7 +46,9 @@ def generate_output(handle): host = cfg['db_host'], user=cfg['db_user'], passwd=cfg['db_pass'], - db=cfg['db_name'] + db=cfg['db_name'], + use_unicode=True, + charset="utf8mb4" ) # print("Generating post for {}".format(handle)) dc = db.cursor(MySQLdb.cursors.DictCursor) @@ -153,7 +155,9 @@ def make_post(args): host = cfg['db_host'], user=cfg['db_user'], passwd=cfg['db_pass'], - db=cfg['db_name'] + db=cfg['db_name'], + use_unicode=True, + charset="utf8mb4" ) c = db.cursor() @@ -190,7 +194,9 @@ def get_key(): host = cfg['db_host'], user=cfg['db_user'], passwd=cfg['db_pass'], - db=cfg['db_name'] + db=cfg['db_name'], + use_unicode=True, + charset="utf8mb4" ) dc = db.cursor(MySQLdb.cursors.DictCursor)