0

Получаю ответ от сайта следующим способом:

HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
string result = "";
using (StreamReader stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("windows-1251")))
{
   result = stream.ReadToEnd();
}
textBox.text = result;

В заголовке ответа поле Content-Type: text/html; charset=windows-1251. Пытаюсь вывести ответ, который пришел, в textbox, но выводится лишь 3 символа непонятной кодировки: , при этом result.Length выдает 33000, заранее спасибо.

1 ответ 1

1

Проблема решена, добавлением строки для HttpWebRequest:

request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.