[issue2387] cStringIO and unicode
Virgil Dupras
report at bugs.python.org
Tue Mar 18 14:28:00 CET 2008
New submission from Virgil Dupras <hsoft at hardcoded.net>:
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 <report at bugs.python.org>
<http://bugs.python.org/issue2387>
__________________________________
More information about the Python-bugs-list
mailing list