I'm using UnicodeCol's in my app, and just found a big shortcoming in
the SQLObject unicode support.

When I specify title = UnicodeCol(length=100), I get an SQL field of
size 100, but the data is encoded so in effect a unicode string can be
truncated even if it has less than 100 chars, the truncation occurs in
SQLObject/database since SQLObject encodes the string to utf-8 which
expands the size, in my case an Hebrew string was expanded twice as
much so I don't get the full 100 chars, but rather 100 octets.

The second and even worse error is that said truncation cut a utf-8
code in the middle, the result was an exception on insertion since the
decode failed. Considering the truncation was done in the SQLObject
layer I thought SQLObject will recover from that itself, but no, it
simply propogated the exception back to me.

My current solution is to use a StringCol and implement _set_title and
_get_title that do the unicode encode/decode but use the 'ignore' error
for the decode so that the exception will not be sent. Not a perfect
solution but it's the best I could do in a quick time.

Baruch


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