summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--templates/patch_view.tmpl6
1 files changed, 5 insertions, 1 deletions
diff --git a/templates/patch_view.tmpl b/templates/patch_view.tmpl
index 52b9036..0a715b9 100644
--- a/templates/patch_view.tmpl
+++ b/templates/patch_view.tmpl
@@ -24,6 +24,10 @@ $escape($str($patch.diffstat))
</div>
<h2>Patch contents</h2>
<div class="patch">
- $pygments.highlight($str($patch).decode('utf-8'), $DiffLexer(), $HtmlFormatter(style='colorful', noclasses=True, encoding='utf-8'))
+ #try
+ $pygments.highlight($str($patch).decode('utf-8'), $DiffLexer(), $HtmlFormatter(style='colorful', noclasses=True, encoding='utf-8'))
+ #except UnicodeDecodeError
+ $pygments.highlight($str($patch).decode('latin-1'), $DiffLexer(), $HtmlFormatter(style='colorful', noclasses=True, encoding='latin-1'))
+ #end try
</div>
#end def