On Wed, Jan 13, 2010 at 10:16, 诚子 <zhicheng1...@gmail.com> wrote: > detial please see > > http://my.unix-center.net/~WeiZhicheng/2010/01/13/sqlalchemy-0-6-unicodedecodeerror-bug-patch/
Well, if I understand correctly, you would like a workaround for a bad truncate algorithm in mysql (which apparently truncates in the middle of a multi-byte character). Are you sure it's not a configuration problem of mysql? I would be amazed if they don't provide a solution to this problem (though that wouldn't be the first time I'm amazed at mysql... sigh...). Now, as to solve your problem (assuming it's not solvable on mysql's side), I think passing another UnicodeDecodingError behavior for the decoder would be a better generic solution. This is not yet possible with the generic types on current SQLAlchemy. See http://www.sqlalchemy.org/trac/ticket/1257 In the meantime, you are free to use a custom type, or type decorator to provide whatever custom decoding mechanism you want. We can't accept your patch though, as it is too specific to your case and would provide a very unexpected behavior in some cases (what if the decoding error is not at the end of the string?). Hope it helps, -- Gaëtan de Menten http://openhex.org
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.