no unicode support in logbook module #52

wants to merge 1 commit into


None yet

3 participants


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.


Guillermo, can't you just use python's "chardet" for that instead of manually selecting the encoding?


@dvarrazzo dvarrazzo added a commit to dvarrazzo/logbook that referenced this pull request Dec 5, 2012
@dvarrazzo dvarrazzo Fixed sending non-ascii messages
This should fix issue #52.

Please use the patchset in #62 instead of this: it is much less approximative. The suggestion of using chardet is also unreliable, apart of being a likely blow to the performance.


Pull request #62 indeed superseeds this one, @guillermo-carrasco, so dropping your changes...

@brainstorm brainstorm closed this Dec 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment