﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2896	Django creates MySQL tables with the default server encoding, but uses utf8 to query them.	lakin@…	Adrian Holovaty	"Django creates MySQL tables with the default server encoding, but uses utf8 to query them. I'm using a legacy MySQL 4.1 database, not my choice (shared hosting).  Because it had a lot of legacy-data, the default encoding for the server, their databases and the tables is ''latin1''.  Django uses a '''SET NAMES 'utf8'''' when connecting to the server.  But Django does not set the Table or Column encodings to ''utf8''.  Rather, it lets MySQL choose.  The combination of ''latin1'' column encodings and a connection encoding of ''utf8'' causes the following error:
{{{
OperationalError at /
(1267, ""Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'"")
}}}

Django should allow for different database encodings, through a settings variable: #952 and #2810.  The default can be ''utf8''. More importantly, the mysql driver backend should use this setting for column and database encodings. (see attached patch which is incomplete, but a start).
"	defect	closed	Database layer (models, ORM)		normal	duplicate			Unreviewed	0	0	0	0	0	0
