Changing the connection character set after you open the connection probably won't work the way you expect. MySQLdb checks the character set after establishing the connection, and sets some of the converters to use it. The best way to manage this in 1.2 is to set it in a configuration file and read it with the read_default_file option to connect (and maybe also use read_default_group). You need an option like this:
[client]
default-character-set = latin2
If you use something other than client, you need read_default_group as well.
If you ever use anything out of the latin2 range, maybe you should use utf8 instead for the default.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i have problem with inserting to mysql:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 10: ordinal not in range(128)
tables are in utf8, data in iso-8859-2, after connection i run "set character set latin2"
mysql 41, mysqldb1.2, active state python 2.4.1
Changing the connection character set after you open the connection probably won't work the way you expect. MySQLdb checks the character set after establishing the connection, and sets some of the converters to use it. The best way to manage this in 1.2 is to set it in a configuration file and read it with the read_default_file option to connect (and maybe also use read_default_group). You need an option like this:
[client]
default-character-set = latin2
If you use something other than client, you need read_default_group as well.
If you ever use anything out of the latin2 range, maybe you should use utf8 instead for the default.