diff options
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/core/db/backends/mysql.py | 7 |
2 files changed, 6 insertions, 2 deletions
@@ -52,6 +52,7 @@ answer newbie questions, and generally made Django that much better: Espen Grindhaug <http://grindhaug.org/> Gustavo Picon Brant Harris + hipertracker@gmail.com Ian Holsman <http://feh.holsman.net/> Kieran Holland <http://www.kieranholland.com> Robert Rock Howard <http://djangomojo.com/> diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py index 629ea8d71f..84fe416f64 100644 --- a/django/core/db/backends/mysql.py +++ b/django/core/db/backends/mysql.py @@ -65,9 +65,12 @@ class DatabaseWrapper: if DATABASE_PORT: kwargs['port'] = DATABASE_PORT self.connection = Database.connect(**kwargs) + cursor = self.connection.cursor() + if self.connection.get_server_info() >= '4.1': + cursor.execute("SET NAMES utf8") if DEBUG: - return base.CursorDebugWrapper(MysqlDebugWrapper(self.connection.cursor()), self) - return self.connection.cursor() + return base.CursorDebugWrapper(MysqlDebugWrapper(cursor), self) + return cursor def commit(self): self.connection.commit() |
