mySQLdb versus platform problem

Robin Becker robin at NOSPAMreportlab.com
Fri Mar 16 18:02:23 EDT 2007


John Nagle wrote:
> Try:
> 
>     db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret',
>     use_unicode=True, charset = "utf8")
> 
> The distinction is that "use_unicode" tells Python to convert to Unicode,
> but Python doesn't know the MySQL table type.  'charset="utf8"' tells
> MySQL to do the conversion to UTF8, which can be reliably converted
> to Unicode.
> 
>                     John Nagle
> 
>.......

OK that seems to help. However, my database has tables with different 
encodings. Does MySQLdb ignore the table encoding? That would be a bit lame.

Also it still doesn't  explain the different behaviours between unix & 
win32 (or perhaps different defaults are somehow magically decided upon).
-things were so much easier when bytes were bytes-ly yrs-
Robin Becker



More information about the Python-list mailing list