批处理之家's Archiver

victorwoo 发表于 2014-8-17 20:38

PowerShell 技能连载 - 修正 ISE 的编码

原始链接:[url=http://blog.vichamp.com/powershell/tip/2014/08/14/correcting-ise-encoding/]PowerShell 技能连载 - 修正 ISE 的编码[/url]
发表日期:2014-08-14
[hr]
[i]适用于所有 PowerShell 版本[/i]

当您在 ISE 编辑器中运行一个控制台程序时,非标准字符,例如“ä”或“ß”将会显示不正常。要修正 ISE 和隐藏的控制台之间通信的编码,请使用这段代码:[code]
# Repair encoding. This REQUIRES a console app to run first because only
# then will ISE actually create its hidden background console

$null = cmd.exe /c echo
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

# Now all is fine

cmd.exe /c echo ÄÖüäöüß
[/code]本文国际来源:[url=http://powershell.com/cs/blogs/tips/archive/2014/08/14/correcting-ise-encoding.aspx]Correcting ISE Encoding[/url]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.