来自 System.Net.WebClient 的 powershell 字符编码
我正在运行以下命令:
([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
? - 如何在 PowerShell 标准输出中获得正确的字符?
I am running the following command:
([xml](new-object net.webclient).DownloadString(
"http://blogs.msdn.com/powershell/rss.aspx"
)).rss.channel.item | format-table title,link
The output for one of the RSS items contains this weird text:
You Don’t Have to Be An Administrator to Run Remote PowerShell Commands
So, the question is:
- Why the mix up in characters? What happened to the apostrophe? Why is the output rendered as
Don’t
when it should just render asDon't
? - How would I get the correct character in the PowerShell standard output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要设置 webclient 的编码属性:
You need to set the encoding property of the webclient: