diff options
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/deb/changelog.py | 8 | ||||
-rw-r--r-- | gbp/git/vfs.py | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index 5cfaaf79..dda9b753 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -128,8 +128,12 @@ class ChangeLog(object): self._cp = cp def _read(self): - with open(self.filename, encoding='utf-8') as f: - self._contents = f.read() + try: + with open(self.filename, encoding='utf-8') as f: + self._contents = f.read() + except UnicodeDecodeError: + with open(self.filename, encoding='iso-8859-1') as f: + self._contents = f.read() def __getitem__(self, item): return self._cp[item] diff --git a/gbp/git/vfs.py b/gbp/git/vfs.py index 8363f77b..ec47201a 100644 --- a/gbp/git/vfs.py +++ b/gbp/git/vfs.py @@ -33,7 +33,10 @@ class GitVfs(object): if binary: self._data = io.BytesIO(content) else: - self._data = io.StringIO(content.decode()) + try: + self._data = io.StringIO(content.decode()) + except UnicodeDecodeError: + self._data = io.StringIO(content.decode("iso-8859-1")) def readline(self): return self._data.readline() |