On 4/12/06, Daniel Vogelheim <[EMAIL PROTECTED]> wrote:

Hello,

thank you all for the helpful comments. I think I found the problem
now, and since it wasn't quite what I expected I'm posting my solution
here in case anyone else has similar problems:


In short, the problem was how to deal with SQLObject + MySQL and
character sets. The good news is, that most of it is automagically
cared for, if one uses the parameter use_unicode in the database URI
in dev.cfg, like this:
  sqlobject.dburi="mysql://.../...?use_unicode=1"

good to know!

The first problem I had then was assertions from SQLObject, apparently
coming from sqlbuilder.py, sqlIdentifier: With use_unicode=1, MySQL
also returns the COLUMN names as unicode, and this method asserts when
it encounters anything except a non-Unicode string. I think this is a
bug, and changing the method to also accept Unicode strings solces
this problem.

The next problem I had was that  fromDatabase=true  would always
generate StringCol objects, instead of UnicodeCol (as several people
have recommended). To solve this, I changed the
MySQLConnection.guessClass method to generate either StringCol or
UnicodeCol columns, depending on the use_unicode parameter. (The
actual charset can be retrieved from MySQL itself, so the code is
completely charset agnostic.)

With those two things done, it seems to work fine now.


I personally would classify both problems as a bug in the MySQL
adapter of SQLObject. I'd be happy to file a bug report and/or submit
a patch, if I knew where and how... :)

http://www.sqlobject.org/community.html you have links there to  tracker/bug,etc the bug report seems to be down now, but you can send a message to the mailing list.

Sincerely,
Daniel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to