[PATCH] highlight: fixes garbled text in non-UTF-8 environment

Martin Geisler mg at lazybytes.net
Fri Sep 4 17:12:10 CDT 2009


Yuya Nishihara <youjah at gmail.com> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1251527055 -32400
> # Node ID 54e7217e12558be85f8ae410f1a168b58b966bae
> # Parent  37042e8b3b342b2e380d8be3e3f7692584c92d33
> highlight: fixes garbled text in non-UTF-8 environment
>
> This patch treats all files inside repository as encoded by
> locale's encoding when pygmentize.

Thanks for the patch. I think this is important enough and isolated
enough to put it into crew-stable, targeting the next minor release. It
is changeset 799373ff2554.

Your patch changes behavior slightly for highlight: before, the
bytestring was decoded as UTF-8 and then Latin-1 (ui.fallbackencoding)
and if that failed, it was forcibly decoded as UTF-8. It is now only
decoded using HGENCODING. I think this is better since it is more
explicit.

A final small thing: I merged your new test-highlight-non-utf8 file into
the existing test for highlight. We generally try to minimize the number
of test files to minimize the overhead of running many tests.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090905/adf1b68a/attachment.pgp 


More information about the Mercurial-devel mailing list