liang naichen - 2008-11-20

hello everyone:

>>> conn = MySQLdb.connection(host ="",user = "root", passwd = "123456", db = "django_test");
>>>
>>> charset = conn.character_set_name()
>>> charset
'latin1_swedish_ci'


the character set of mysql is latin1,'latin1_swedish_ci' is the correspoding collation;however conn.character_set_name() returns 'latin1_swedish_ci',it is obviously wrong.
LookupError: unknown encoding: latin1_swedish_ci
oh my god.
when I use django's session, I need to first create several tables,so I input the following command:
./manage.py syncdb
then error took place
"LookupError: unknown encoding: latin1_swedish_ci"
and I traced back it and found that the content of 146-149 rows in the file cursors.py are:
db = self._get_db()
charset = db.character_set_name()
if isinstance(query, unicode):
query = query.encode(charset)
because charset is 'latin1_swedish_ci',
query = query.encode('latin1_swedish_ci')
then
!!!"LookupError: unknown encoding: latin1_swedish_ci"!!!

can anyone give some suggestions?
thank you in advance!