Fwd: [Bug 340394] Re: redirecting log output to a file produces the wrong encoding on win32
Alexander Belchenko
bialix at ukr.net
Tue Apr 21 12:07:41 BST 2009
Martin Pool пишет:
> https://launchpad.net/bugs/340394
>
> Does anyone have a clear idea of
> 1- what output encoding bzr should use on Windows when output is
> redirected to a file and running in a terminal using cp850?
What do you mean by "should"?
Current implementation uses terminal encoding, in this case it will be
cp850. If terminal is not available, then there will be used default
user encoding, in this case it will be cp1252.
Here is the list of supported encodings (ANSI and OEM):
http://msdn.microsoft.com/ru-ru/goglobal/bb964654(en-us).aspx
http://msdn.microsoft.com/ru-ru/goglobal/bb964655(en-us).aspx
As you see there is no UTF-8 encoding in any form, so user unable to
switch the terminal encoding to UTF-8. Only to cp1252, because it's the
best match for cp850 (cp850 is OEM, cp1252 is ANSI encoding).
To switch encoding of the terminal user can use chcp command.
When this command invoked without arguments it will print current codepage.
E.g. on my machine with Russian settings:
C:\>chcp
Active code page: 866
C:\>chcp 1251
C:\>chcp
Active code page: 1251
> 2- what mechanism if any should be available to control it?
>
> I suppose we could (like svn?) have a parameter that specifies the
> output encoding...
Yes, PLEASE. I think it should be global option, available to all
commands. E.g.
bzr --encoding=utf-8 log
More information about the bazaar
mailing list