我正在运行以下命令:
([xml](new-object net.webclient).DownloadString(
"http://blogs.msdn.com/powershell/rss.aspx"
)).rss.channel.item | format-table title,link
其中一个RSS项的输出包含这个奇怪的文字:
You Don’t Have to Be An Administrator to Run Remote PowerShell Commands
所以,问题是:
Don’t
时应该呈现为Don't
?答案 0 :(得分:11)
您需要设置webclient的编码属性:
$wc = New-Object System.Net.WebClient
$wc.Encoding = [System.Text.Encoding]::UTF8
([xml]$wc.DownloadString( "http://blogs.msdn.com/powershell/rss.aspx" )).rss.channel.item | format-table title,link