On 5/29/07, David Smith <[EMAIL PROTECTED]> wrote:
>
>
> > My exprience shows that it may be necessarily to specify encoding  for
> > mysql in dburi.
> >
> > The reason is that mysql server may be configured with default encoding
> > that doesn't match the database you're connecting to. E.g. if you open
> > mysql console and type \s you can see something like latin1 while
> database
> > is utf8-encoded. In a situation like this you do need to tell db
> encoding
> > explicitly. So I guess it makes sense to always be explicit here.
>
> I guess I should have been more explicit. The point is that it shouldn't
> matter if your database uses e.g. iso-8859-1 internally, as long as it can
> hold the bytes. UTF-8 is just another encoding, and the point is that it
> should be the job of SQLAlchemy (or insert your other platform's ORM) to
> convert into the database's encoding and back out to unencoded Python
> unicode objects. Thus, if you want the DB internal data to be stored in
> UTF-8, you should configure that in your database server settings, not in
> your application.


Hmm. Not sure I agree completely.

One database server supports multiple clients / databases which means every
one may have different settings. Encoding spec is part of dburi syntax in
sqlalchemy, along with other connections settings, such as username. This
seems right to me.

OTOH, the application doesn't need to know database encoding, it's just an
implementation detail. UnicodeString gives you precisely this.


> You surely want to use Unicode instead of String. It will do the right
> > thing (converting to and from unicode objects). Also, if the setup is
> > wrong, you'll discover it sooner when it'll try to decode utf8 data
> > assuming latin1 charset.
>
> This again is the same point as above; SQLAlchemy should determine that
> the
> DB is not utf-8 and is indeed latin1 or iso-8859-1 or whatever.


I don't want the tool to outsmart me. ;)

Max.

--~--~---------~--~----~------------~-------~--~----~
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