[issue2926] Incorrect encoding used to print on windows console
Andrei Polushin
bugs at mercurial.selenic.com
Wed Jul 27 01:41:32 UTC 2011
New submission from Andrei Polushin <polushin at gmail.com>:
On Windows console, internationalized messages are always output in Windows
ANSI encoding, while the console uses OEM encoding by default. Thus the
messages are unreadable.
E.g. in Russian translation, the default encoding is cp866, while the
messages are printed in cp1251. The workaround is to issue `chcp 1251` shell
command before running any hg commands. Using the workaround is inconvenient
and not always possible.
More info and suggestions:
1. When running in console mode, sys.stdout.encoding is correctly
initialized by Python to an actual encoding the console is using. Python
uses GetConsoleOutputCP API to detect this. However, sys.stdout.encoding is
totally ignored by Mercurial.
2. When running in piped mode (redirected to file etc.), sys.stdout.encoding
is None. In this case, I suggest to use UTF-8 encoding.
----------
messages: 16982
nosy: polushin
priority: bug
status: unread
title: Incorrect encoding used to print on windows console
topic: windows
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2926>
____________________________________________________
More information about the Mercurial-devel
mailing list