Changed how the request content-length is set

Bug causes some requests to fail with a
System.Net.ProtocolViolationException ("Bytes to be written to the
stream exceed the Content-Length bytes size specified.") when using
non-ASCII characters (like Swedish åäö). Now fixed.