16 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Ascii codec instead ...
FromSent OnAttachments
Arun Kumar PG15 Aug 2007 08:33 
jason kirtland15 Aug 2007 08:44 
Arun Kumar PG15 Aug 2007 09:01 
Michael Bayer15 Aug 2007 10:17 
Arun Kumar PG15 Aug 2007 10:56 
Arun Kumar PG15 Aug 2007 10:57 
Andrew Stromnov15 Aug 2007 11:17 
jason kirtland15 Aug 2007 11:23 
Arun Kumar PG15 Aug 2007 11:32 
jason kirtland15 Aug 2007 11:36 
Arun Kumar PG16 Aug 2007 03:04 
Arun Kumar PG19 Aug 2007 02:22 
jason kirtland19 Aug 2007 09:28 
Arun Kumar PG20 Aug 2007 00:35 
jason kirtland20 Aug 2007 11:18 
Arun Kumar PG21 Aug 2007 00:32 
Subject:[sqlalchemy] Re: Ascii codec instead of unicode ?
From:Arun Kumar PG (arun@gmail.com)
Date:08/20/2007 12:35:37 AM
List:com.googlegroups.sqlalchemy

So in short if I specify use_unicode=True at the SA engine level then I can skip specifying use_unicode and specify only charset=utf8 at mysqldb level ?

On 8/19/07, jason kirtland <je@discorporate.us> wrote:

Arun Kumar PG wrote:

Ok, you need to get that charset to the driver. Try removing SET NAMES from your init_command, and instead pass charset=utf8 and use_unicode=0 in your database connection URL.

why do we want to say use_unicode=0 instead or use_unicode=True here?

You can go either way with that. The MySQLdb driver's default behavior when given a 'charset' is to also turn on its "return all strings in Unicode" mode. If you want all of your strings as Unicode that's just dandy, but if you expecting them to come back as regular strings encoded in the charset you requested you'd be in for a surprise...

In my own code I enable use_unicode and I don't specify any Unicode options or column types at the SQLAlchemy level.

- A