Tip or bug? Leaning towards bug. Note that examples are with MySQL-python-1.1.8; the first example is with MySQL-4.0.22, and the second with with 4.1.8.
I'm having this problem with 4.1.10-nt-log. It's very frustrating, I spent ages trying to work out what was going on! I got around it (in MySQLdb) by changing the line in connections.py that says self.charset = self.character_set_name().split('_')[0] to read self.charset = 'utf8'. It's messy, obviously, but it works for me.
User Comments
With MySQL-4.0, mysql_character_set_name() does what you expect:
>>> import MySQLdb
>>> db=MySQLdb.connect(read_default_file="~/.my.cnf")
>>> db.character_set_name()
'latin1'
With MySQL-4.1, mysql_character_set_name() returns the collation, and not the character set name:
>>> import MySQLdb
>>> db=MySQLdb.connect(read_default_file="~/.my.cnf")
>>> db.character_set_name()
'latin1_swedish_ci'
Tip or bug? Leaning towards bug. Note that examples are with MySQL-python-1.1.8; the first example is with MySQL-4.0.22, and the second with with 4.1.8.
The problem above is supposedly fixed in 4.1.9 and 5.0.3.
I'm having this problem with 4.1.10-nt-log. It's very frustrating, I spent ages trying to work out what was going on! I got around it (in MySQLdb) by changing the line in connections.py that says self.charset = self.character_set_name().split('_')[0] to read self.charset = 'utf8'. It's messy, obviously, but it works for me.
Add your own comment.