Permalink
Browse files

if print raise UnicodeEncodeError, try to encode string to utf-8 (issue

  • Loading branch information...
1 parent d057d13 commit 999629e487ee77fce2512b2ac18e84a899552995 @gornostal committed Jan 26, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 Modific.py
View
@@ -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()

0 comments on commit 999629e

Please sign in to comment.