Sorry to ressurrect this thread but the problem is still there. Since SQLAlchemy knows the encoding used to communicate with the database, it can properly decode the error strings returned by the database to unicode. So, I think it should be SQLAlchemy's responsibility to convert the error strings to unicode, not the user's responsibility. Could we open a bug for that in the tracker?
Sylvain Le vendredi 7 mars 2008 02:39:56 UTC+1, jean-philippe dutreve a écrit : > > On 7 mar, 02:29, Michael Bayer <mike...@zzzcomputing.com> wrote: > > > logging module itself throws UnicodeDecodeError ? > yes, in logging.format: ... = "%s" % msg > with msg the exception message encoded in utf8 and the default > encoding is ascii. > > > are you sending exception messages using logging.debug() or similar ? > exactly: log.error("... : %s", e.message) > > my impression > > is that you'd want to decode those manually doing something like > > string.decode('utf-8'). > yes, it works fine, but it's pain to do this in each try/except. > Another solution is setting utf8 as the default encoding in > sitecustomize.py. > It's better centralized, but has sitepackage effect. > > But a better way IMHO is that the DB driver or SA returns unicode > exception message. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/OOEvbKoo63cJ. To post to this group, send email to sqlalchemy@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.