c# - process.standardInput encoding problem -


I have a problem with the encoding process. Standout Input Encoding I am using some process in my Windows form but input should be UTF-8 process. Standard input Encoding is read only, so I can not set it in UTF-8 and it becomes the default encoding of Windows which spoils good native characters in UTF-8. In the program, 2 processes are used, one writes the output to the file and other readers, because I can set the output encoding to UTF-8 because this part is working properly, but reading back is the part where I'm having problems I will include the part where I use this process.

  Procostart Infos Info = New ProcessStartInfo ("MySisk"); Info.RedirectStandardInput = True; Info.RedirectStandardOutput = false; Info.Arguments = mysqldumpstring; Info.UseShellExecute = false; Info.CreateNoWindow = True; Process P1 = new process (); P1.StartInfo = info; P1.Start (); String res = file.ReadToEnd (); File.Close (); MessageBox.Show (p1.StandardInput.Encoding.EncodingName); // where should be the encoding encoding .UTF8; P1.StandardInput.WriteLine (race); P1.Close (); Using StreamWriter, the next method (instead of the standard input), gives the desired result:  

  Streamerver utf8writer = new streamer (proc.StandardInput.BaseStream, encoding.UTF8); Utf8Writer.Write (...); Utf8Writer.Close ();  

Comments