You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to write unicode strings into a
StringIO.StringIO() or a cStringIO.StringIO()
file, different things occur. (This causes
a failing test in the "mako" project if
cStringIO is not available.) Compare the
following with StringIO or with cStringIO:
With cStringIO, unicode strings are
immediately encoded as ascii and the
getvalue() returns '\xC0hello'. With
StringIO, on the other hand, the
getvalue() crashes in a ''.join()
trying to convert 'xC0' to unicode.
Normal file() objects follow the same
behavior as cStringIO, so my guess is
that StringIO.py is wrong here.
It's intentional that they behave differently. StringIO supports Unicode strings, cStringIO doesn't. This means that you can build up a large Unicode string with StringIO, but not with cStringIO.
What should happen when you mix them is debatable.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: