Mercurial > public > mercurial-scm > hg
diff tests/test-highlight @ 7120:db7557359636
highlight: convert text to local before passing to pygmentize (issue1341)
Example case:
Display file written in iso-8859-1 with current HGENCODING utf-8.
At the moment only an Error page appears because pygmentize
chokes on the replacement chars.
Alternatives:
1) Turn off highlighting and avoid UnicodeDecodeError
for files that are not in HGENCODING.
2) [this patch] use util.tolocal to display these files.
Alternative 2) seems ok, as this only concerns display and
readability.
See also: fe38b0a3a928, apparently put aside during refactor of
highlight.
Add test for UnicodeDecodeError with iso-8859-1 file contents.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Fri, 17 Oct 2008 12:12:33 +0200 |
parents | f29b674cc221 |
children | c5e37dc38a52 |
line wrap: on
line diff
--- a/tests/test-highlight Sat Oct 18 04:26:06 2008 -0500 +++ b/tests/test-highlight Fri Oct 17 12:12:33 2008 +0200 @@ -12,6 +12,10 @@ hg init test cd test cp $TESTDIR/get-with-headers.py ./ + +# check for UnicodeDecodeError with iso-8859-1 file contents +python -c 'fp = open("isolatin", "w"); fp.write("h\xFCbsch\n"); fp.close();' + hg ci -Ama echo % hg serve @@ -22,6 +26,10 @@ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/get-with-headers.py') \ | sed "s/[0-9]* years ago/long ago/g" | sed "s/class=\"k\"/class=\"kn\"/g" +echo % hgweb filerevision, html +("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/isolatin') \ + | sed "s/[0-9]* years ago/long ago/g" | sed "s/class=\"k\"/class=\"kn\"/g" + echo % hgweb fileannotate, html ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/get-with-headers.py') \ | sed "s/[0-9]* years ago/long ago/g" | sed "s/class=\"k\"/class=\"kn\"/g"