I am running a console application (myApp.exe) that outputs a pseudo-localized string (unicode) to standard output. If I run this on a regular command line (cmd.exe), the data in unicode is lost. If I run this on the unicode command line (cmd.exe / u) or set the console properties to "Lucida Console", then the unicode string is saved.
I want to run this application in C # and redirect the unicode string to a local variable. I use a Process object with RedirectStandardOutput = true, but the unicode string is always lost.
How can I specify to store this information in Unicode?
private static int RunDISM(string Args, out string ConsoleOutput)
{
Process process = new Process();
process.StartInfo.FileName = "myApp.exe";
process.StartInfo.Arguments = Args;
try
{
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
process.Start();
process.WaitForExit(Int32.MaxValue);
}
catch (Exception e)
{
WEX.Logging.Interop.Log.Assert("Failure while starting or running process.\nERROR: " + e.Message);
ConsoleOutput = null;
return EXITCODE_ERROR;
}
ConsoleOutput = process.StandardOutput.ReadToEnd();
return process.ExitCode;
}