diff options
author | Guus Sliepen <guus@debian.org> | 2018-06-05 21:43:10 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-06-07 08:48:00 +0200 |
commit | 48ef0ecff04f52734a3e0424201df6f303d1c9cd (patch) | |
tree | de45bd38a9ac3fec9bfb51067a168181509b1f92 /gbp/git | |
parent | 6c30ac945a6f17772100e3cf9cce8f2bd4dbad4e (diff) |
changelog: try iso8859-1 when utf-8 fails
Fall back to iso8859-1 when opening the changelog. Helps when importing
old versions.
Closes: #900841
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/vfs.py | 5 |
1 files changed, 4 insertions, 1 deletions
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() |