我同时使用 cvs 和 bzr 进行版本控制,并且更喜欢在 powershell 控制台中运行它们。但是当我运行 cvs 时,它会更改控制台编码,这会使 bzr 抛出错误消息。我尝试在我的 PSProfile 中将 $OutputEncoding 设置为 UTF-8,然后 bzr 似乎很高兴......直到我运行 cvs,然后 bzr 再次开始抱怨 - 即使 $OutputEncoding 是相同的!?
有没有办法让两者在同一个控制台中工作?
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
Visual Studio 2010 Command Prompt variables set.
PS W:\> [Console]::OutputEncoding.EncodingName
Western European (DOS)
PS W:\> bzr st
bzr: ERROR: Not a branch: "W:/".
PS W:\> [Console]::OutputEncoding.EncodingName
Western European (DOS)
PS W:\> cvs up
cvs update: No CVSROOT specified! Please use the `-d' option
cvs [update aborted]: or set the CVSROOT environment variable.
PS W:\> [Console]::OutputEncoding.EncodingName
Unicode (UTF-8)
PS W:\> bzr st
bzr: warning: unknown terminal encoding cp65001.
Using encoding cp1252 instead.
bzr: warning: unknown terminal encoding cp65001.
Using encoding cp1252 instead.
bzr: ERROR: Not a branch: "W:/".
PS W:\>
在 PSProfile 中强制 OutputEncoding 为 UTF8 的示例。
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
Visual Studio 2010 Command Prompt variables set.
PS W:\> $OutputEncoding
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : True
CodePage : 65001
PS W:\> bzr st
bzr: ERROR: Not a branch: "W:/".
PS W:\> cvs up
cvs update: No CVSROOT specified! Please use the `-d' option
cvs [update aborted]: or set the CVSROOT environment variable.
PS W:\> $OutputEncoding
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : True
CodePage : 65001
PS W:\> bzr st
bzr: warning: unknown terminal encoding cp65001.
Using encoding cp1252 instead.
bzr: warning: unknown terminal encoding cp65001.
Using encoding cp1252 instead.
bzr: ERROR: Not a branch: "W:/".
PS W:\>