Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Programs receive their command lines in UTF-16, the same encoding as .NET strings:</p> <pre><code>Arguments = "/U /K \"echo これはテストです&gt; output.txt\""; </code></pre> <p>It is the console window that cannot display characters outside of it's current codepage/selected font. However, I am assuming that you don't want to call echo, so this depends entirely on how the program you are calling is written.</p> <p>Some background info: C or C++ programs that use the 'narrow' (system code page) entry points, eg <code>main(int argc, char** argv)</code>, rather than the 'wide' (UTF-16) entry points, <code>wmain(int argc, wchar_t** argv)</code>, are called by a stub that converts the commandline to the system codepage - which cannot be UTF-8.</p> <p>By far the best option is to change the program to use a wide entrypoint, and simply get the same UTF-16 as you had in your .NET string. If that is not possible, then one trick you could try is to pass it a UTF-16 commandline that when converted to the system codepage is UTF-8 for the characters you want it to use:</p> <pre><code>Arguments = Encoding.Default.GetString(Encoding.UTF8.GetBytes(args)); </code></pre> <p>Caveat Coder: Don't be surprised if this goes horribly wrong on your or someone else's machine, it depends on every possible byte being valid in the current system codepage, the system codepage not being different from when your program was started, the program you are running not using the data to any encoding dependent Windows function (those with A, W suffixed versions), and so on.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload