mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
5168c29e12
Summary: On Windows, there are *two* 8-bit encodings for each process. * The ANSI code page is used for all `...A` system calls, and this is what Mercurial uses internally. It can be overridden using the `--encoding` command line option. * The OEM code page is used when outputing to the console. Mercurial has no concept of this, and instead renders to the console using the ANSI code page, which results in mojibake like "Θ" instead of "é". Add the concept of an `outputencoding`. If this differs from `encoding`, we convert from the local encoding to the output encoding before writing to the console. On non-Windows platforms, this defaults to the same encoding as the local encoding, so this is a no-op unless `--outputencoding` is manually specified. On Windows, this defaults to the codepage given by `GetOEMCP`, causing output to be converted to the OEM codepage before being printed. For ordinary strings, the local encoded version is wrapped by `localstr` if the encoding does not round-trip cleanly. This means the output encoding works even if the character is not represented in the local encoding. Unfortunately, the templater is not localstr-clean, which means strings can get flattened down to the local encoding and the original code points are lost. In this case we can only output characters which are in the intersection of the encoding and the output encoding. Most US English Windows systems use cp1252 for the ANSI code page and cp437 for the OEM code page. These both contain many accented characters, so users with accented characters in their names will now see them correctly rendered. All of this only applies to Python 2.7. In Python 3, everything is Unicode, the `--encoding` and `--outputencoding` options do nothing, and it just works. Reviewed By: quark-zju, ikostia Differential Revision: D19951381 fbshipit-source-id: d5cb8b5bfe2bc131b2e6c3b892137a48b2139ca9 |
||
---|---|---|
.. | ||
hgdemandimport | ||
hgext | ||
mercurial | ||
__init__.py | ||
__main__.py | ||
traceimport.py |