1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 09:36:21 +01:00

Merge pull request #528 from lethliel/python3_fix_bsc1129889

[python3] add exception if encoding fails and try ISO-8859-1
This commit is contained in:
Marco Strigl 2019-04-16 15:49:29 +02:00 committed by GitHub
commit 393290bfe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,5 +61,9 @@ def decode_it(obj):
import chardet
return obj.decode(chardet.detect(obj)['encoding'])
except:
import locale
return obj.decode(locale.getlocale()[1])
try:
import locale
return obj.decode(locale.getlocale()[1])
except:
return obj.decode('latin-1')