dealing with special characters in Python and MySQL

John Nagle nagle at animats.com
Mon Dec 18 01:55:56 EST 2006


ronrsr wrote:
>>are you passing in the strings as Unicode strings, or as something else?
>>  if you're using something else, what have you done to tell the
>>database what it is?
>>
> 
> 
> 
> not at all sure what I'm passing it as.
> 
> The database default  encoding is utf-8
> the database collation is utf-8
> the page encoding of the page is utf-8
> 
> what else do I have to tell the database?
> 
    Try putting "use_unicode=True" in the MySQLdb "connect" call.

    See
 
http://sourceforge.net/tracker/index.php?func=detail&aid=1559350&group_id=22307&atid=374932

and look at other charset related bugs at

http://sourceforge.net/tracker/?atid=374932&group_id=22307&func=browse

Also note that MySQLdb didn't support this until recently, so check
your version of MySQLdb.  There still seem to be problems in that area.

				John Nagle
				Animats



More information about the Python-list mailing list