title: WebClient Encoding
body: <p>When I'm sending a request with Webclient, my request string is converted to ????</p>
  
  <p>I set the Encoding, but it's not working.<br></p>
  
  <p>This is my Code:<br></p>
  
  <pre><code>using (var client = new WebClient(){ Encoding = Encoding.UTF8 })
  {
      client.Encoding = ASCIIEncoding.UTF8;
      client.Headers[HttpRequestHeader.ContentType] = "application/octet-stream";
      client.Encoding = Encoding.ASCII;
      client.Headers.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
      client.Headers.Add("Content-Encoding: UTF-8");
  
      string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("admin" + ":" + "123456"));
      client.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials);
      client.Headers.Add("command:12");
  
      byte[] bret = client.UploadData("http://192.168.1.1", "POST",
                    System.Text.Encoding.ASCII.GetBytes("code=سلام;field2=value2"));
  
      string sret = System.Text.Encoding.ASCII.GetString(bret);
      MessageBox.Show(sret);
  }
  </code></pre>
  
  <p>sniffing with Wireshark, the request string convert to ??? :</p>
  
  <blockquote>
    <p>POST / HTTP/1.1<br> Authorization: Basic YWRtaW46MTIzNDU2<br> command:
    setPersons12<br> Content-Type: application/json; charset=utf-8<br>
    Host: 192.168.1.21:8080<br> Content-Length: 23<br> Expect:
    100-continue<br> Connection: Keep-Alive<br></p>
    
    <p>code=????;field2=value2HTTP/1.1 200 OK<br> Content-Length: 10<br>
    Content-Type: application/json; charset=UTF-8<br></p>
  </blockquote>