How change encoding ?

Posted by simply denis on Stack Overflow See other posts from Stack Overflow or by simply denis
Published on 2011-01-17T18:29:11Z Indexed on 2011/01/17 18:53 UTC
Read the original article Hit count: 167

Filed under:
|

I need convert or set encoding windows-1251

Process p = new Process();
StreamWriter sw;
StreamReader sr;
StreamReader err;



ProcessStartInfo psI = new ProcessStartInfo("cmd");
psI.UseShellExecute = false;

psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;


p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;



sw.AutoFlush = true;
if (tbComm.Text != "")
    sw.WriteLine(tbComm.Text);
else
    //execute default command
    sw.WriteLine("dir \\");


sw.Close();

textBox1.Text = sr.ReadToEnd();// this not support russian word. I need convert or set encoding windows-1251
textBox1.Text += err.ReadToEnd();

© Stack Overflow or respective owner

Related posts about c#

Related posts about encoding