On 5/29/07, David Smith <[EMAIL PROTECTED]> wrote:
> jj, I actually agree strongly with you regarding the potential dangers. My
> counter argument is that if you specify the encoding of the database in the
> config file to a different encoding than is in the mysql config file, don't
> you risk double-encoding anyway?

Double encoding should *theoretically* never happen because MySQLdb
knows if it has a unicode object or a UTF-8 string.

> Now that the bug is fixed in MySQLdb, and
> no other database needs such options, I'd prefer to promote the Unicode
> field as the proper way forward. SQLAlchemy should, via the MySQLdb module,
> determine at runtime the encoding of the database and translate from that
> encoding to unicode objects as necessary (as should any other ORM).

To tell you the truth, I don't feel strong either way.  As long as *I*
the application developer don't need to do the encoding, and as long
as the database and I agree about the encoding, it doesn't matter to
me who does it.

All the database drivers SHOULD support encoding for you.  After all,
not everyone uses SQLAlchemy.  Personally, I think this should have
gone in the DBAPI spec.  However, if someone wants to let SQLAlchemy
do the work, I don't have any objections.

Happy Hacking!
-jj

> Shannon -jj Behrens wrote:
>
> >
> > I'm not necessarily disagreeing with you, but I do think it's really
> > bad practice to have your database confused about the encoding of the
> > data that it's storing.  At one point, I had things messed up and the
> > data in the database was double encoded.  Sure, it worked as long as I
> > was using SQLAlchemy, but if I ever decided to use something else, I
> > would have been in really bad shape.  Fortunately, they fixed that bug
> > in MySQLdb.
> >
> > Happy Hacking!
> > -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 [email protected]
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