[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

2013-11-05 Thread Paweł Wroniszewski
New submission from Paweł Wroniszewski: I encountered the problem in logging module, but it is broader then that. Have a look at the following code: import time DATE_FORMAT = '%d/%b/%Y %H:%M:%S%z %Z' print(time.strftime(DATE_FORMAT)) print(time.strftime(DATE_FORMAT,time.localtime

[issue19267] Logging to file does not accept UTF16

2013-10-15 Thread Paweł Wroniszewski
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

[issue19267] Logging to file does not accept UTF16

2013-10-15 Thread Paweł Wroniszewski
Paweł Wroniszewski added the comment: Hi Victor. Your fix works, but actually using simply ufs='%s\n' also seem to work, as type( '%s' % u'foo') and type( u'%s' % u'foo') returns the same - unicode. So I would suggest dropping ufs completely, and changing the two occurences to fs. It works

[issue19267] Logging to file does not accept UTF16

2013-10-15 Thread Paweł Wroniszewski
Paweł Wroniszewski added the comment: Btw I also don't see the purspose of fs.decode(stream.encoding), as it should rather be encoded and not decoded... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19267

[issue19267] Logging to file does not accept UTF16

2013-10-15 Thread Paweł Wroniszewski
Paweł Wroniszewski added the comment: Cool - looks good to me as well. Thanks guys. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19267