[issue1759845] subprocess.call fails with unicode strings in command line

Kuang-che Wu report at bugs.python.org
Wed Aug 4 09:11:30 CEST 2010


Kuang-che Wu <kcwu at csie.org> added the comment:

> I fail to see why subprocess.call(cmd.encode('whatever')) is not a general solution.
Because 'whatever' encoding doesn't exist.

Assume cmd contains Japanese characters and my system is Chinese windows. subprocess.call expect the argument is encoded in mbcs, which is cp950. However, cp950 encoding doesn't contain Japanese characters.

subprocess.call(cmd.encode('cp950')) will fail because cp950 doesn't contain Japanese characters.
subprocess.call(cmd.encode('cp932')) will fail because subprocess.call will decode fail or incorrectly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1759845>
_______________________________________


More information about the Python-bugs-list mailing list