Skip to content

Commit

Permalink
if print raise UnicodeEncodeError, try to encode string to utf-8 (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Gornostal committed Jan 26, 2013
1 parent d057d13 commit 999629e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Modific.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@ def hl_lines(self, lines, hl_key):
def diff_done(self, diff):
if diff and '@@' not in diff:
# probably this is an error message
print diff
# if print raise UnicodeEncodeError, try to encode string to utf-8 (issue #35)
try:
print diff
except UnicodeEncodeError:
print diff.encode('utf-8')

diff_parser = DiffParser(diff)
(inserted, changed, deleted) = diff_parser.get_lines_to_hl()
Expand Down

0 comments on commit 999629e

Please sign in to comment.