Here’s how to write a string into a stream using a given character encoding:
UTF8Encoding encoding = new UTF8Encoding(); //Encoding encoding = Encoding.GetEncoding("iso-8859-1"); byte[] bytes = encoding.GetBytes(postData); stream.Write(bytes, 0, bytes.Length);
It might be useful to know that to get the encoding for DOS text it will mostly work fine with Encoding.GetEncoding(“ibm850”) (also known as “Western European (DOS)” at this site: http://a4esl.org/c/charset.html).
/Emil