1. Luke Plant
  2. django

Commits

adr...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed a7ba97d

Fixed #1121 -- Changed MySQL backend to use correct character set in MySQL 4.1x/5.x on Win32. Thanks, hipertracker@gmail.com

  • Participants
  • Parent commits 5a519d9
  • Branches default

Comments (0)

Files changed (2)

File AUTHORS

View file
     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/>

File django/core/db/backends/mysql.py

View file
             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()