我需要从具有 win-1251 代码页的页面获取数据。
$SiteAdress = "http://www.gisinfo.ru/download/download.htm"
$HttpContent = Invoke-WebRequest -URI $SiteAdress
echo $HttpContent
它向我展示了:
> StatusCode : 200 StatusDescription : OK Content :
> <!DOCTYPE html>
> <html><!-- #BeginTemplate "/Templates/panorama.dwt" --><!-- DW6 -->
> <head>
> <!-- #BeginEditable "doctitle" -->
> <title>ÃÈÑ ÏÀÍÎÐÀÌÀ - Ñêà÷àòü ïðîãðàììû</title>
> <meta name="keywords" con... RawContent : HTTP/1.1 200 OK
> Transfer-Encoding: chunked
> Connection: keep-alive
> Keep-Alive: timeout=20
> Content-Type: text/html
> Date: Fri, 16 Oct 2015 12:40:45 GMT
> Server: nginx/1.5.7
> X-Powered-By: PHP/5.2.17...
标题是西里尔文。我试过下面的变种,但结果是一样的。
$HttpContent = Invoke-WebRequest -URI $SiteAdress -ContentType "text/html; charset=windows-1251"