> The wchar_t strings themselves are built with mbstowcs(),
> the file system encoding is not used.
Oops sorry, you are right, and it's worse :-) sys.argv is decoded using the locale encoding, but subprocess & cie use the file system encoding for the reverse operation. => it doesn't work if both encodings are different (#4388, #8775).
The pseudo-code to create sys.argv on Unix is:
# argv is a bytes list
encoding = locale.getpreferredencoding()
sys.argv = [arg.decode(encoding, 'surrogateescape') for arg in argv] |