diffs: handle very odd case of binary, corrupted diffs which crashed the diff parser.
This commit is contained in:
parent
26be0cd3c6
commit
d60fd3ca7a
1 changed files with 7 additions and 1 deletions
|
|
@ -168,7 +168,13 @@ def render_tokenstream(tokenstream):
|
|||
if op_tag:
|
||||
result.append(u'<%s>' % op_tag)
|
||||
|
||||
escaped_text = html_escape(token_text)
|
||||
# NOTE(marcink): in some cases of mixed encodings, we might run into
|
||||
# troubles in the html_escape, in this case we say unicode force on token_text
|
||||
# that would ensure "correct" data even with the cost of rendered
|
||||
try:
|
||||
escaped_text = html_escape(token_text)
|
||||
except TypeError:
|
||||
escaped_text = html_escape(safe_unicode(token_text))
|
||||
|
||||
# TODO: dan: investigate showing hidden characters like space/nl/tab
|
||||
# escaped_text = escaped_text.replace(' ', '<sp> </sp>')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue