[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
'a'>>import StringIO, cStringIO
StringIO.StringIO('a').getvalue()
'a'>>cStringIO.StringIO('a').getvalue()
u'a'>>StringIO.StringIO(u'a').getvalue()
'a\x00\x00\x00'>>cStringIO.StringIO(u'a').getvalue()
I would have thought StringIO and cStringIO would return the>>>
same result for this ascii-encodeable string. Worse:
u'a'>>StringIO.StringIO(u'a').getvalue().encode('utf-8').decode('utf-8')
does the right thing, but
u'a\x00\x00\x00'>>cStringIO.StringIO(u'a').getvalue().encode('ut f-8').decode('utf-8')
looks bogus. Am I misunderstanding something?