mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 17:16:23 +01:00
add exception if encoding fails and try ISO-8859-1
In some rare cases the chardet encoding detection detects a wrong encoding standard. Then we switch to latin-1 which covers most if utf-8 does not work.
This commit is contained in:
parent
71770555ac
commit
5841bf759f
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user