title: Silverlight: Encoding a webClient stream
body: <p>I've been trying to get this to work, but I'm very frustrated at this point. I am a beginner in this field, so maybe I'm just making mistakes. </p>
  
  <p>What I need to do is to take in a website .html and store it into a txt file. Now the problem is that this website is in Russian (encoding windows-1251) and Silverlight only supports 3 encodings. So in order to bypass that limitation, I got my hands on an encoding class that transfers the stream into a byte array and then tries to pull the correctly encoded string from the text. The problem with this is that </p>
  
  <p>1) I try to ensure that webClient recieves a Unicode encoded stream, because the other ones do not seem to create a retrievable string, but it still doesn't seem to work.</p>
  
  <pre><code>WebClient wc = new WebClient();
          wc.Encoding = System.Text.Encoding.Unicode;
          wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_LoadCompleted);
          wc.DownloadStringAsync(new Uri(site));
  </code></pre>
  
  <p>2) I fear that when I store the html into a txt file using streamWriter, the encoding is, yet again, somehow screwed up.
  3) The encoding class is not doing its job.</p>
  
  <pre><code>Encoding rus = Encoding.GetEncoding(1251);
          Encoding eng = Encoding.Unicode;
          byte[] bytes = rus.GetBytes(string);
          textBlock1.Text = eng.GetString(bytes);
  </code></pre>
  
  <p>Can anyone offer any help on this matter? This huge detriment to my project. Thanks in advance,</p>