Special characters in commit message on command line

Sune Foldager cryo at cyanite.org
Mon Jun 20 09:19:15 CDT 2011

On 2011-06-20 09:15, Matt Mackall wrote:
>On Mon, 2011-06-20 at 13:41 +0200, Sune Foldager wrote:
>> On 2011-06-17 13:48, Matt Mackall wrote:
>> >On Fri, 2011-06-17 at 13:42 -0500, Robert Altman wrote:
>> >> Is there any way to enter special characters in a commit message when typing
>> >> at the command line?
>> >>
>> >> For example:
>> >> hg commit -m"Too many changes to describe!"
>> >> hg commit -m"Changes 'mebabytes' to megabytes'"
>> >
>> >On Windows, this will be hard. The console and the GUI (ie where your
>> >usual commit editor lives) don't agree about how to encode characters,
>> >so Mercurial goes by the _GUI's_ idea of the current encoding.
>> Depends... notepad defaults to the system charset, and the console does
>> as well. So as long as the characters are in that charset it's ok.
>That's usually NOT the case. For instance, in the US, the console uses
>cp437 which is essentially the hardware font on the original IBM PC for
>compatibility with ancient DOS apps:
>Whereas the GUI (and notepad) use cp1252, which is a bastardized version
>of ISO 8859-1:
>..and there is NO overlap of codepoints between these two outside of the
>ASCII subset.
>On these systems, when you're running Mercurial in the console (cp437),
>Mercurial ignores that and uses the OTHER encoding (cp1252) exclusively
>for compatibility with the GUI side of things. So if you attempt to pass
>non-ASCII chacters in the console codepage (ó -> 0xA2 in cp437) to it on
>the command line, you will fail (0xA2 -> ¢ in cp1252).
>You can use "chcp cp1252" in the console to make the two agree, in which
>case everything should work fine.

True, over here terminals default to 850 or similar, and we set it to 1252
in our company-wide profile. It's a complete mess :-p.


More information about the Mercurial mailing list