我同时使用 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 中强制输出编码为 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:>
一种解决方案是在 bazaar.conf 中提供输出编码选项。
cp65001 被添加到 python 3.3 (错误)所以如果 bzr 端口到 py3k,这将被修复(我希望......