Comment 10 for bug 340394

Revision history for this message
Martin Pool (mbp) wrote : Re: redirecting log output to a file produces cp850 on win32

2009/4/21 Alexander Belchenko <email address hidden>:
> 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

OK, so I've changed bug 340394 to be about that, as it seems that we can't do any better at present by just using the encoding of the environment.

--
Martin <http://launchpad.net/~mbp/>