[PATCH] patch: decode e-mail headers
Rafaël Carré
funman at videolan.org
Tue Oct 22 19:38:25 CDT 2013
Le 23/10/2013 02:26, Augie Fackler a écrit :
>
> On Oct 22, 2013, at 8:25 PM, Rafaël Carré <funman at videolan.org>
> wrote:
>
>> $ hg init utf $ cd utf $ hg import ../utf8.patch $ hg log | grep
>> ^user - user: ë
>>
>> It currently fails with:
>>
>> --- /media/dev/hg/tests/test-import.t +++
>> /media/dev/hg/tests/test-import.t.err @@ -1169,5 +1169,10 @@ $ hg
>> init utf $ cd utf $ hg import ../utf8.patch + applying
>> ../utf8.patch + transaction abort! + rollback completed +
>> abort: decoding near '\xc3\xab': 'ascii' codec can't decode byte
>> 0xc3 in position 0: ordinal not in range(128)! (esc) + [255] $
>> hg log | grep ^user - - user: ë + [1]
>>
>>
>> Something goes bad in hg import with LANG=C and I'm not sure
>> why.
hg attempts to convert an already utf-8 string from the user locale
(ascii) to utf-8.
HGENCODING=UTF-8 fixes this of course, as UTF-8 was guessed from my
$LANG=fr_FR.UTF-8
The problem is that the encoding is specified by the patch itself and
not by the user environment.
What to do here?
If I use encoding.tolocal() there's no crash anymore but instead of
'ë' I see '?'
>> Why is the backtrace hidden here?
>
> pass --debug --traceback to the hg import call and you'll get all
> the gory details.
Thanks
More information about the Mercurial-devel
mailing list