[Mono-list] Prevent preamble sending to the StandardInput of a process

Mathias Tausig mtausig at fsmat.at
Wed Jan 27 06:39:30 EST 2010


Hello!

I am trying to call shell commands via the System.Diagnostics.Process class and want to send them some input through the Process.StandardInout StreamWriter.
My problem is, that this StreamWriter is somehow (probably through some system default) set to use UTF-8 encoding and thus sends the byte order makr (BOM) of "ef bb bf" before my data as a preamble. And exactly these bytes are screwing up the shell applications (in this case: openssl).

I know that I can disable this in a new StreamWriter, but I did not find an y possibility to change the Process.StandardInput StreamWriter in any way. ProcessStartInfo only allows me to set the encoding of StadndrdOutput and StandrdError.

Does anyone know, how I can actually change the encoding of Process.StandardInput?

cheers
Mathias


More information about the Mono-list mailing list