Guido van Rossum <guido@python.org> writes: > Though it acts somewhat as if its default encoding is "ascii". This > is somewhat inconsistent: you can write arbitrary Unicode strings, but > the Unicode won't be converted to ASCII. ASCII is converted to > Unicode though. It is the only case of a "pure Unicode" stream in Python, where the underlying "native" sequence is not one of bytes, but one of Unicode characters. The real problem is that the "orientation" (wide or narrow strings) is determined by the things written into the stream. It might be more reasonable to have StringIO.ByteIO and StringIO.UnicodeIO constructors, which both accept an encoding= argument, and will convert objects of the wrong "orientation" using that encoding (defaulting to the system encoding). Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4