On 5/10/07, Christoph Haas <[EMAIL PROTECTED]> wrote:
>
> On Thu, May 10, 2007 at 02:37:13PM -0700, Shannon -jj Behrens wrote:
> > On 5/10/07, Christoph Haas <[EMAIL PROTECTED]> wrote:
> > > Where (in a standard Pylons project) would I set use_unicode=True? I
> > > just found references to "create_engine" in the websetup.py which is
> > > obviously not the right place. And my models/__init__.py just has the
> > > line
> > >
> > >     meta = DynamicMetaData()
> >
> > I fought long and hard with this problem.  Back then, it turned out
> > that letting SQLAlchemy do the encoding with use_unicode=True wouldn't
> > work because of a bug in MySQLdb.  However, it looks like that bug has
> > been fixed in a recent release of MySQLdb.
> >
> > These days, I bet you can just add ?use_unicode=1 to the end of your
> > db uri, and it'll work.
>
> Do you mean "encoding='utf-8'" or "convert_unicode=True" as documented
> in http://www.sqlalchemy.org/docs/dbengine.html#dbengine_options ?

I bet encoding='utf-8' is the default anyway.  I think
convert_unicode=True is what you want in the uri.  The trick is to pay
attention to both what the database is storing and what MySQLdb is
using.  There's three layers to worry about:  SQLAlchemy, MySQLdb, and
MySQL (and pay attention to the default encoding, the default database
encoding, the default table encoding, and the field encoding...ugh).

Best of Luck,
-jj

-- 
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to