New submission from Virgil Dupras <[EMAIL PROTECTED]>: hsoft-dev:python hsoft$ python Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from cStringIO import StringIO >>> StringIO(u'foo').read() 'foo' >>> hsoft-dev:python hsoft$ ./python.exe Python 2.6a1+ (trunk:61515, Mar 18 2008, 13:38:47) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from cStringIO import StringIO >>> StringIO(u'foo').read() 'f\x00o\x00o\x00' >>>
The documentation says: Unlike the memory files implemented by the StringIO module, those provided by this module are not able to accept Unicode strings that cannot be encoded as plain ASCII strings. Attached a patch to test_StringIO. ---------- components: Library (Lib) files: cStringIO_unicode_test.diff keywords: patch messages: 63911 nosy: vdupras severity: normal status: open title: cStringIO and unicode type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file9726/cStringIO_unicode_test.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2387> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com