ProcessStartInfo startInfo = new ProcessStartInfo("CMD.exe");
startInfo.Arguments = "/c " + URL;
Process p = new Process();
startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow = true;
p = Process.Start(startInfo);
string original = p.StandardOutput.ReadToEnd();
string result1 = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(original));
string result2 = Encoding.BigEndianUnicode.GetString(Encoding.BigEndianUnicode.GetBytes(original));
string result3 = Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(original));
string result4 = Encoding.UTF32.GetString(Encoding.UTF32.GetBytes(original));
string result5 = Encoding.UTF7.GetString(Encoding.UTF7.GetBytes(original));
string result6 = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(original));
cmd output contains russian letters, that can't be decoded properly with all encodings what I tried. Please help.
I tried:
startInfo.StandardOutputEncoding = Encoding."all possible encodings";
but no help.
any ideas?
Old question, but no possible correct answer.
Here it is:
process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(850);
850 is the standard cmd-page. So the user which is using the application will get the characters just as he would expect when using the command line itself.
This one solved all symbol-problems on a german OS for me.
OEM code pages:
437 - English
708 - Arabic (ASMO)
720 - Arabic (Microsoft)
737 - Greek
775 - Baltic
850 - Western European (Multilingual Latin I)
852 - Middle European (Latin II)
855 - Cyrillic
857 - Turkish
858 - Western European (Multilingual Latin I + Euro)
860 - Portuguese
861 - Icelandic
862 - Hebrew
863 - Canadian French
864 - Arabic (IBM)
865 - Nordic
866 - Russisch
869 - Greek
1254 - Turkish
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With