title: Convert utf8 to 1251
body: <p>Okay so the problem is as follows. I have to get the information from an online form and then submit it again(changed). The page is in "windows-1251" and in my request I get it with:</p>
  
  <pre><code>{
           // used to build entire input
          StringBuilder sb = new StringBuilder();
  
          // used on each read operation
          byte[] buf = new byte[8192];
  
          // prepare the web page we will be asking for
          HttpWebRequest request = (HttpWebRequest)
              WebRequest.Create(url);
  
          // execute the request
          HttpWebResponse response = (HttpWebResponse)
              request.GetResponse();
  
          // we will read data via the response stream
          Stream resStream = response.GetResponseStream();
  
          string tempString = null;
          int count = 0;
  
          do
          {
              // fill the buffer with data
              count = resStream.Read(buf, 0, buf.Length);
  
              // make sure we read some data
              if (count != 0)
              {
                  // translate from bytes to ASCII text
                  tempString = Encoding.GetEncoding(1251).GetString(buf, 0, count);
  
                  // continue building the string
                  sb.Append(tempString);
              }
          }
          while (count &gt; 0); // any more data to read?
  
          // print out page source
          // Console.WriteLine(sb.ToString());
          return sb.ToString();
  </code></pre>
  
  <p>So after that I strip the page and get my data into an array and I need to post it to the site again but it needs to be encoded. I use System.Net.WebUtility.UrlEncode to do the encoding but I get a completely different results from my script and from firefox(I got the original using tamper data). So any help or ideas are appreciated. BTW after I got the encoded data (from the script) I tried it online at <a href="http://www.url-encode-decode.com/" rel="nofollow">http://www.url-encode-decode.com/</a> and only UTF-8 returned the proper result. So I'm guessing I have to convert it to 1251 and I tried doing that but it was still gibberish and completely different that what it was supposed to be... So please if you can help me it will be great... :)</p>
  
  <p>Edit:</p>
  
  <pre><code>Expected: %E3%F0%E0%E4+%D1%EE%F4%E8%FF
  Actual: %D0%B3%D1%80%D0%B0%D0%B4+%D0%A1%D0%BE%D1%84%D0%B8%D1%8F
  f2[11] = град София
  -       f2  {string[180]}   string[]
      [0] "127.0.0.1" string
      [1] "1348247257"    string
      [2] "1n132135075318435" string
      [3] "151669n1"  string
      [4] "0" string
      [5] null    string
      [6] null    string
      [7] null    string
      [8] "2" string
      [9] "12871449760521116" string
      [10]    "14"    string
      [11]    "град София"    string
      [12]    "Враждебна" string
      [13]    "42.707984,23.41341,0~бул. Ботевградско шосе"   string
      [14]    "42.7100653,23.4274006,1"   string
  </code></pre>