Parcourir la source

Prefering utf8 in parsing response for labkeyDatabaseBrowser

Andrej il y a 4 mois
Parent
commit
28114bd6f0
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      labkeyDatabaseBrowser.py

+ 2 - 1
labkeyDatabaseBrowser.py

@@ -81,7 +81,8 @@ class labkeyDB:
       data=response.data
       encoding=chardet.detect(data)["encoding"]
       #try with a set of encodings to maximize probability of success
-      encodings=[encoding,'utf_8']
+#prefer utf8
+      encodings=['utf_8',encoding]
       for x in encodings:
          try:
             return json.loads(data.decode(x))