mitsuhiko/logbook — pull request #52 by guillermo-carrasco (2012-04-01 15:44:53+00:00)
Title: no unicode support in logbook module

Hi mitsuhiko,

I received an issue track telling me that unicode was not supported by logbook module. When we tried to write log entries in any non-pure ascii language (like Swedish or Spanish), an UnicodeDecodeError was raised if non-ascii character were used (like with the words häj or España).

I was looking at that and I found that python was trying to decode the record.message with the default decoder charset, which is 'ascii'. So what I've done is add a previous decoding in the format function of the generic handler.

I was trying all handlers and a similar problem was happening with MailHandler. As python default mail module also does not support unicode without parsing it, I added also a previous parsing in generate_mail function.

I hope this is helpful for you, and sorry if not.