[issue5768] logging don't encode Unicode message correctly.

Amaury Forgeot d'Arc report at bugs.python.org
Thu Apr 16 14:32:00 CEST 2009


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

I think that in r69448, the test does not match the code:
codecs.getwriter('cp1251') has no attribute 'encoding', and no function
in test_logging ever pass a stream with an explicit encoding.

Also, the test in emit() should be reversed, otherwise msg.encode() is
called only when msg is a 8bit string. And in this case, a unicode
string should be passed to the stream.

See attached patch.
The codecs.getwriter should probably grow an 'encoding' attribute
automatically, but this is another issue.

----------
assignee:  -> vsajip
nosy: +amaury.forgeotdarc, vsajip
Added file: http://bugs.python.org/file13705/logging_encoding.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5768>
_______________________________________


More information about the Python-bugs-list mailing list