2
나는에 StandardOutput
에 대한 specify the encoding에 당신은 할 수 있어야 변환하거나 창-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();
psI.StandardOutputEncoding = Encoding.GetEncoding (1251); - 도와주지 마. mayby는 StreamReader 인코딩을 변경합니까? – Mediator
@simply denis : 내가 틀릴 수도 있지만'StreamReader' 인코딩은 생성시에만 설정할 수 있다고 생각합니다. 그 후에는 읽기 전용입니다. 'Process' 안에서 생성되고 있기 때문에,'Process' 나'ProcessStartInfo'에 어떻게 든 설정해야합니다. 나는 _think_ (필자는 지금 테스트 할 컴파일러 앞에 있지 않다). – David