New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shlex (or perhaps cStringIO) and unicode strings #43912
Comments
Python 2.5c1 (r25c1:51305, Aug 19 2006, 18:23:29) (Also seen in 2.4) shlex.split do not like unicode strings: >>> shlex.split(u"foo")
['f\x00\x00\x00o\x00\x00\x00o\x00\x00\x00'] The shlex code IMO suggests that it should accept Digging slightly into this, this seems to be a >>> sys.getdefaultencoding()
'ascii'
>>> cStringIO.StringIO(u'foo').getvalue()
'f\x00\x00\x00o\x00\x00\x00o\x00\x00\x00' Perhaps cStringIO should .encode to ASCII encoding |
Logged In: YES Thanks for your report, this is now fixed in rev. 52301, |
Still happens on latest 2.7: >>> from cStringIO import StringIO
>>> sio = StringIO(u"abc")
>>> sio.getvalue()
'a\x00b\x00c\x00' |
And unsurprisingly so, since the fix was reverted in r56830 by Georg. |
Georg, is this patch ok to you? |
If you think it's fine to change this behavior, then yes :) |
New changeset 27ae7d4e1983 by Antoine Pitrou in branch '2.7': |
Well, the "documented" behaviour makes no sense. |
New changeset 0b39f2486314 by Éric Araujo in branch '2.7': |
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: