summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-09-06 21:30:09 +0200
committerSean Finney <seanius@debian.org>2009-09-06 21:30:09 +0200
commitee7e7301434b1cf8b3baa4d839fdbf2f05617e91 (patch)
tree074107f0da51e1dcb7dbaeabcb75f7feb82495e4
parentc2ef848129e03d5486ff3d084d903a7ef7ea658b (diff)
downloadpatch-tracker-ee7e7301434b1cf8b3baa4d839fdbf2f05617e91.tar.gz
try both utf8 and latin-1 for contents in Patch constructor
thanks to Raphael Geissert for catching this
-rw-r--r--patchtracker/Patch.py6
1 files changed, 5 insertions, 1 deletions
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):