title: HttpRequest Some Special characters are not encoded properly
body: <p>I have a windows service that posts data to a web service. It either sends a PUT or POST request depending on the data. The problem that I am facing is that some special characters are not getting sent properly in the POST request although they are sent properly in the PUT request.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>protected void InitializeRequest(String url, String method)
          {
              _Request = (HttpWebRequest)WebRequest.Create(new Uri(url));
              _Request.Method = method;
              _Request.Accept = Settings.AcceptHeader;
              _Request.Headers.Add("Authorization", Settings.AuthorizationHeader);
          }
  
  
  public void SendData(String json)
  {
  
  byte[] byteArray = Encoding.UTF8.GetBytes(json);
  
                  _Request.ContentType = "application/json";
  
                  _Request.ContentLength = byteArray.Length;
  
                  try
                  {
                      Stream dataStream = _Request.GetRequestStream();
                      dataStream.Write(byteArray, 0, byteArray.Length);
                      dataStream.Close();
  
                      var response = (HttpWebResponse)_Request.GetResponse();
                      bierResponse = ParseResponse(response);
                      response.Close();
                  }
  }
  </code></pre>
  
  <p>As you can see I am using the same method for POST and PUT the only difference is the InitializeRequest method which sets the _Request.Method property differently.</p>
  
  <p>The data that I am trying to post contains this string <strong>æøåÆØÅ</strong> which gets transmitted properly for PUT request but gets messed up on POST.</p>
  
  <p>My gut feeling is that the .Net framework handles these in different ways but I have no way to confirm that.</p>