瀏覽代碼

Prefering utf8 in parsing response for labkeyDatabaseBrowser

Andrej 4 月之前
父節點
當前提交
28114bd6f0
共有 1 個文件被更改,包括 2 次插入1 次删除
  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))