I'm making a post request with HttpRequestMessage/HttpResponseMessage. Everything is okay, I'm getting the response into a string whose length is correct as expected, but if I want to display the raw string, it just returns one question mark character (?) and nothing else, as if the output is just one/two characters of length.
I've tried to decode the string to UTF8, still the same.
Here is my code:
var targetUrl = new Uri("https://www.targetUrl.com/");
var postData = GetPostData;
var request = httpClientHelp.GetRequest(HttpMethod.Post, targetUrl, postData);
var response = Await httpRequestProcess.SendAsync(request);
var data = Await response.Content.ReadAsStringAsync();
Debug.WriteLine(data.Length); // Correct, i.e. 5686
Debug.WriteLine(data); // Just displays "?"
//. Here is the SendAsync function from the httpRequestProcess class:
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage requestMessage)
{
var response = await Client.SendAsync(requestMessage);
return response;
}
Here is the difference between the string content and its length
If I copy that question mark, the output is a multiple set of unknown characters, example: � �