如何获取返回的utf-8编码正文

橘子皮... 橘子皮... 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
sUrl = @"http://my.37.com/user/userinfo.php";
xmlhttp = new WinHttpRequest();
xmlhttp.SetTimeouts(30000, 30000, 30000, 30000);
xmlhttp.Open("GET", sUrl, true);
xmlhttp.SetRequestHeader("Accept", "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, */*");
xmlhttp.SetRequestHeader("Accept-Language", "en-US");

如果用winhttp组件的话

StreamReader reader = new StreamReader(xmlhttp.ResponseStream, Encoding.GetEncoding("UTF-8"));
x = reader.ReadToEnd();

用上面的方法获取返回的网页源码,总是提示StreamReader 最匹配的重载方法具有一些无效参数
请问winhttp在c#里如何把ResponseStream或者ResponseBody 按UTF8格式转成string ???
...全文
评论 4
收藏 已收藏
分享
返回顶部
橘子皮...
C# 111,128 成员 642,537 内容