no unicode support in logbook module #52

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

Contributor

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.

Collaborator

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

http://pypi.python.org/pypi/chardet

Cheers!
Roman

@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.
10e8762
Contributor

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.

Collaborator

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