Changes by Naoki INADA songofaca...@gmail.com:
--
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6991
___
___
Python-bugs-list
Changes by Benjamin Peterson benja...@python.org:
--
assignee: - vinay.sajip
nosy: +vinay.sajip
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6991
___
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
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
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
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,
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
___