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

Kuang-che Wu report at bugs.python.org
Tue May 12 05:33:22 CEST 2009


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

There is slight difference between C and python patch.
C version: convert mbcs argument to unicode
py version: convert unicode argument to mbcs

Actually, python version patch may not work if the string is unicode and
cannot encoded by mbcs. For example, my windows system is Chinese
(cp950) and the program I want to execute contains Japanese characters.
Encode Japanese characters with mbcs (in this case, it is cp950) will
fail. This is also what Matt (mclausch) said.

On the other hand, the C version patch. I don't think fall-back is
necessary. If the string is failed to convert from mbcs to unicode, it
will be eventually failed inside CreateProcessA() because CreateProcessA
internally (after win2k) will try to convert from mbcs to unicode and
call CreateProcessW.

----------

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


More information about the Python-bugs-list mailing list