'Some specials characters are wrong in response of post request

I am trying to make a post request and receive a pdf text, but the response comes with multiple "�", that makes pdf only a white page.

            client.DefaultRequestHeaders.Clear();
            client.DefaultRequestHeaders.Add("Host", "bankline.itau.com.br");
            client.DefaultRequestHeaders.Add("accept", "application/json");
            client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0");
            client.DefaultRequestHeaders.Add("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3");
            client.DefaultRequestHeaders.Add("Referer", "https://ww2.itau.com.br/2viabloq/blqpesquisado.asp");
            client.DefaultRequestHeaders.Add("Origin", "https://ww2.itau.com.br");
            client.DefaultRequestHeaders.Add("Connection", "keep-alive");
            client.DefaultRequestHeaders.Add("Cookie", "*****************");
            client.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var values4 = new Dictionary<string, string>
            {
                { "id", idPost },
                { "op", opPost }
            };

            var content4 = new FormUrlEncodedContent(values4);

            var response4 = await client.PostAsync(url5, content4);

            var buffer = await response4.Content.ReadAsByteArrayAsync();
            var byteArray = buffer.ToArray();
            var responseString4 = Encoding.UTF8.GetString(byteArray, 0, byteArray.Length);

            return responseString4;

This is making a post request in a url that is normally reached by normal browser access and it is working fine, but when I do this post request it returns this wrong special character multiple times in text.

Example of what I get:

in the first lines:

%PDF-1.4
%����

in the middle of document:

stream
H��W[o�6~����C)�)]G�s��n_�=02����T������e{��$q��c~���(L��

but some parts are correct:

/XObject <</Im0 10 0 R 
>>
/ProcSet [/PDF 
/Text 
/ImageC 
/ImageI 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source