[New-bugs-announce] [issue19267] Logging to file does not accept UTF16

Paweł Wroniszewski report at bugs.python.org
Tue Oct 15 17:08:24 CEST 2013


New submission from Paweł Wroniszewski:

The following code reproduces the error:

import logging
logging.root.addHandler(logging.FileHandler(filename='test.log',encoding='UTF16'))
logging.error( u'b\u0142\u0105d')

I think the problem is in the line
logging/__init__.py:860: ufs = fs.decode(stream.encoding)

as Python can't really handle the following code:

fs = "%s\n"
print fs.decode('utf16') % u'foo'

----------
components: Library (Lib)
messages: 200001
nosy: pwronisz, vinay.sajip
priority: normal
severity: normal
status: open
title: Logging to file does not accept UTF16
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list