Read HTTPWebReponse using GetResponseStream readToEnd return strange characters

佐手、 提交于 2019-12-23 15:44:20

问题


we are reading response from HttpWebResponse and the response itself is quite normal, we think. But when we try to read the string representation of that, we only receive strange characters instead of json formatted normal chars. Can anyone please tell us what is wrong here? Any question or help is welcomed, if more informations are needed, please comment. Thanks


回答1:


The response content encoding header is gzip indicating the content has been compressed by the server.

Set request.AutomaticDecompression to tell the HttpWebResponse you want it to decompress the data automatically.



来源:https://stackoverflow.com/questions/33080674/read-httpwebreponse-using-getresponsestream-readtoend-return-strange-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!