andymckay/zamboni — comment on commit db90c62142c30e008a14a17ca0755c67b8f5527c
File: log_settings.py line 38
By kumar303:

I know you were copying/pasting but this should be:

if isinstance(prio, unicode):
prio = prio.encode('utf-8')

and the same for msg below.

The reason is that when strings with non-ascii are re-encoded the Python magic gets all screwed up:

>>> u'Ivan Krsti\u0107'.encode('utf8')
'Ivan Krsti\xc4\x87'
>>> u'Ivan Krsti\u0107'.encode('utf8').encode('utf8')
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 10: ordinal not in range(128)
>>>