Hi Max, thanks for the quick response,

Max Ischenko 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.

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

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.

Cheers,
David



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