From ee7e7301434b1cf8b3baa4d839fdbf2f05617e91 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Sun, 6 Sep 2009 21:30:09 +0200 Subject: try both utf8 and latin-1 for contents in Patch constructor thanks to Raphael Geissert for catching this --- patchtracker/Patch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'patchtracker/Patch.py') diff --git a/patchtracker/Patch.py b/patchtracker/Patch.py index 670f389..16bcaa6 100644 --- a/patchtracker/Patch.py +++ b/patchtracker/Patch.py @@ -26,7 +26,11 @@ class Diffstat: class Patch: def __init__(self, fh, level=1): - self.p = fh.readlines() + lines = fh.readlines() + try: + self.p = unicode(lines) + except UnicodeDecodeError: + self.p = unicode(lines, 'latin-1') self.lvl = level def __str__(self): -- cgit v1.2.3