[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Changes by Naoki INADA songofaca...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6991 ___ ___ Python-bugs-list

[issue6991] logging encoding failes some situation

2009-09-25 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- assignee: - vinay.sajip nosy: +vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6991 ___

[issue6991] logging encoding failes some situation

2009-09-25 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Thanks, but I'm not sure I understand the reasoning. stream.write(unicode_string) should not do decode() internally, though of course it would do encode(). Can you explain a little more (with an illustrative example) what problem you are

[issue6991] logging encoding failes some situation

2009-09-25 Thread Naoki INADA
Naoki INADA songofaca...@gmail.com added the comment: Please see and execute an attached foo.py. In Python 2.6.2, this cause following error: python foo.py Traceback (most recent call last): File foo.py, line 3, in module f.write('\xaa') File C:\usr\Python2.6\lib\codecs.py, line 686, in

[issue6991] logging encoding failes some situation

2009-09-25 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: There seems to be a problem with your foo.py. In it, you are writing a byte-string to a stream returned from codecs.open. I don't think this is correct: you should be writing a Unicode string to that stream, which will convert to bytes using

[issue6991] logging encoding failes some situation

2009-09-24 Thread Naoki INADA
New submission from Naoki INADA songofaca...@gmail.com: When stream is codecs.writer object, stream.write(string) does string.decode() internally and it may cause UnicodeDecodeError. Then, fallback to utf-8 is not good. I think good fallback logic is: * When message is unicode,

[issue6991] logging encoding failes some situation

2009-09-24 Thread Naoki INADA
Changes by Naoki INADA songofaca...@gmail.com: -- versions: +Python 3.0, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6991 ___