[PATCH 0 of 2] highlight: encode to hgweb.encoding to avoid tracebacks

Christian Ebert blacktrash at gmx.net
Thu Dec 13 03:22:31 CST 2007


* Christian Ebert on Thursday, December 13, 2007 at 00:03:31 +0100
> First patch replaces unnecessary keyword arguments.
> 
> Second patch tries to make a consistent approach at avoiding
> tracebacks due to UnicodeDecodeError:
> 
> - We need to pass encoding parameters to pygments lexers and
>  formatter.
> - We set util._encoding to hgweb.encoding to avoid conflicts
>  between input and output encoding.
> - To ensure that the lexer can digest its input, we encode the
>  input with util.tolocal.

This has the following side-effect:

Assuming a file in iso-8859-1 viewed with HGENCODING=UTF-8 eg. in
hgwebdir.cgi and browser display charset UTF-8, we get:
- replacement chars without highlight
- converted output with highlight

Still less of a showstopper than a traceback.

c


More information about the Mercurial-devel mailing list