From 34237e62927039ae01a7a2aedd2c549e89cb4da2 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 16 Jun 2017 15:32:09 -0400 Subject: [PATCH] Changes the default charset for MySQL (#282) This bug is actually quite sneaky and was breaking exports --- CTFd/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CTFd/__init__.py b/CTFd/__init__.py index 63e07141..1dd466c0 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -43,7 +43,11 @@ def create_app(config='CTFd.config.Config'): # Creates database if the database database does not exist if not database_exists(url): - create_database(url) + if url.drivername.startswith('mysql'): + url.query['charset'] = 'utf8mb4' + create_database(url, encoding='utf8mb4') + else: + create_database(url) # Register database db.init_app(app)