Issue 5659: logging.FileHandler encoding parameter does not work as expected (original) (raw)

Issue5659

Created on 2009-04-01 22:50 by warp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
l.py warp,2009-04-01 22:50
Messages (3)
msg85106 - (view) Author: Kuno (warp) Date: 2009-04-01 22:50
When attempting to use the encoding="" parameter of logging.FileHandler I always get a UnicodeError. This looks like a bug to me (otherwise I am seriously misunderstanding what the parameter is supposed to do). The attached file contains the code to reproduce this error. Traceback (most recent call last): File "/usr/local/stow/Python-2.6.1/lib/python2.6/logging/__init__.py", line 765, in emit self.stream.write(fs % msg.encode("UTF-8")) File "/usr/local/stow/Python-2.6.1/lib/python2.6/codecs.py", line 686, in write return self.writer.write(data) UnicodeDecodeError: 'ascii' codec can't decode byte 0xec in position 0: ordinal not in range(128) For completeness: I am running a self-compiled Python 2.6.1 on the current Debian GNU/Linux testing release.
msg85178 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-04-02 07:27
This was a regression in 2.6, previously reported in issue #5170, and was fixed in trunk in r69447 and in the release26-maint branch in r69448.
msg85240 - (view) Author: Kuno (warp) Date: 2009-04-02 18:54
Ah! Good to know that it has been fixed already. Thank you.
History
Date User Action Args
2022-04-11 14:56:47 admin set github: 49909
2009-04-02 18:54:23 warp set messages: +
2009-04-02 07:27:55 vinay.sajip set status: open -> closedresolution: fixedmessages: +
2009-04-01 22:55:25 benjamin.peterson set assignee: vinay.sajipnosy: + vinay.sajip
2009-04-01 22:50:44 warp create