Hi David,

On 5/29/07, David Smith <[EMAIL PROTECTED]> wrote:
>
>
> Max, I have no problems by only using Unicode field-types in my model;
> that
> is, my sqlalchemy connection string does not contain anything related to
> UTF-8. I haven't investigated my MySQL setup so thoroughly but it seems to
> work with MySQL 4 and 5 and stable and development versions of mysqldb. It
> is quite possible that the data being stored in the database is in
> iso-8859-1 or whatever MySQL uses by default but SQLAlchemy is
> automatically manipulating the binary stirngs into Unicode objects based
> on
> the encoding of the database.


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.

Ideally, I'd like to see a best practice of, basically, stop worrying
> specifically about MySQL database encoding and all of its nastiness and
> simply use Unicode fields instead of String fields for data that holds
> natural language characters.


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.

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