hg apply aborts when changelog contains non-ASCII character on Windows

NEW
Unassigned

Status

mozilla.org
MozillaBuild
2 months ago
2 months ago

People

(Reporter: xidorn, Unassigned)

Tracking

Details

When I run
> hg import https://reviewboard-hg.mozilla.org/gecko/rev/1040f13fa3fcab02005c56d0befb78f173a8fb18

It fails with
> abort: decoding near 'io Cobos Álvarez <e': 'charmap' codec can't decode byte 0x81 in position 14: character maps to <undefined>!

This is because emilio's name contains a non-ASCII character "Á". (This is definitely not the first time I hit this :/)

Looking at Mercurial's code, it seems to be picking encoding with the following code:
> try:
>     encoding = environ.get("HGENCODING")
>     if not encoding:
>         encoding = locale.getpreferredencoding().encode('ascii') or 'ascii'
>         encoding = _encodingfixers.get(encoding, lambda: encoding)()
> except locale.Error:
>     encoding = 'ascii'

It's not completely clear to me what it means, but if I set HGENCODING to UTF-8, then the command can complete successfully.

I'm not sure whether it is something MozillaBuild should contain a fix for, or that Mercurial should fix for Windows.
You need to log in before you can comment on or make changes to this bug.