JavaScript strings represent Unicode characters (internally encoded in UTF-16). Care must be taken to preserve Unicode compliance when communicating with external programs - wherever possible.
The Process class passes the command line to the operating system (and thus to the external program) in full Unicode compliance:
On Mac OS the command line is UTF-8 encoded, which is the default filename encoding and which turns out to be compatible with virtually all command-line tools.
On Windows the command line is passed using a "wide" (16-bit-character) system call; external programs should retrieve command line arguments using the "wide" (16-bit-character) version of the Windows-specific "GetCommandLine" function rather than the argv[] argument in the main C function (which supports only characters that can be encoded in the current ANSI code page).
The Process class uses the following scheme for communicating with the stdin and stderr/stdout text streams:
Text is written to stdin using UTF-8 encoding.
Text is read from stdout/stderr using UTF-8 encoding, unless the text doesn't conform to UTF-8 syntax, in which case it is interpreted using the current ANSI code page (on Windows) / MacRoman or Latin1 encoding (on Mac OS).
While this behavior is not perfect in all cases, note that:
UTF-8 is upwards compatible with 7-bit ASCII.
If a byte stream conforms to UTF-8 syntax, there is a very high probability that it represents a text string in UTF-8 encoding (as opposed to a text string in one of the common 8-bit legacy encodings).