[issue15216] Support setting the encoding on a text stream after creation
Nick Coghlan
report at bugs.python.org
Mon Mar 4 10:18:56 CET 2013
Nick Coghlan added the comment:
That's a fair point - I think it's acceptable to throw an error in the case of *already decoded* characters that haven't been read.
There's also a discussion on python-ideas about an explicit API for clearing the internal buffers, and pushing data back into a stream. If that is added, then set_encoding() would be free to error out if there was any already buffered data - it would be up to the application to call clear_buffer() before calling set_encoding(), and deal with an such data appropriately (such as calling push_data() with the results of the clear_buffer() call)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15216>
_______________________________________
More information about the Python-bugs-list
mailing list