title: Reading a stream that may have non-ASCII characters
body: <p>I have an application that reads string data in from a stream.  The string data is typically in English but on occasion it encounters something like 'Jalapeño' and the 'ñ' comes out as '?'.  In my implementation I'd prefer to read the stream contents into a byte array but I could get by reading the contents into a string.  Any idea what I can do to make this work right?</p>
  
  <p>Current code is as follows:</p>
  
  <pre><code>byte[] data = new byte[len];  // len is known a priori
  byte[] temp = new byte[2];
  StreamReader sr = new StreamReader(input_stream);
  int position = 0;
  while (!sr.EndOfStream)
  {
    int c = sr.Read();
    temp = System.BitConverter.GetBytes(c);
    data[position] = temp[0];
    position++;
  }
  input_stream.Close();
  sr.Close();
  </code></pre>