R. David Murray added the comment:

I think that this is a reasonable request, and probably applies to the whole 
shlex module, although less strongly.

You could use the surrogateescape hack to work around the problem:

  shlex.quote(mydata.encode('ascii', 'surrogateescape')).decode('ascii', 
'surrogateescape)

That might be the only practical way to handle bytes input to the shlex parser, 
if we do also want to tackle that.

Note that it is already the case that os module functions that retrn filenames 
and stdin/stdout use surrogateescape, so a naive program may actually work with 
binary filenames (which is why the handler is used in those contexts).

----------
keywords: +easy
nosy: +r.david.murray
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.6 -Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25567>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to