[DB-SIG] Unicode interaction with the python DBAPI?

Paul DuBois paul at snake.net
Mon Jul 26 21:43:02 CEST 2004


At 15:19 -0400 7/26/04, Andy Dustman wrote:
>On Mon, 26 Jul 2004 10:28:12 -0400, Mihai Ibanescu <misa at redhat.com> wrote:
>
>>  What is the driver supposed to do when it receives Unicode data?
>
>MySQLdb does it this way: If you pass unicode=True to connect(), then
>any string data is returned as Unicode strings; otherwise it uses
>normal strings. In MySQL < 4.1, the character set is server
>configuration variable, and won't change during the course of
>execution. In MySQL >= 4.0 (I think 4.1 is included in this), you can
>set character sets on columns (or maybe just tables); so far, >= 4.1
>is not supported by MySQLdb.

For being able to assign character sets to columns and tables:
Its >= 4.1, not >= 4.0.  And you really should use 4.1.1 or greater,
because it changed a lot of stuff compared to 4.1.0.

>
>Even if you don't set unicode=True, it will encode any unicode strings
>passed as parameters into normal strings (needed to insert into the
>query statement; parameter substitution is in 4.1).



More information about the DB-SIG mailing list