aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2022-01-03 20:02:19 +0000
committerzsloan2022-01-03 14:07:22 -0600
commitc5c5de8aa9a8078ba5d955f2fc22dbc2c2494610 (patch)
treea81469654f93725c89622a53c7135adfe6b6b2c6
parentcb8fc335ece8e7ceabab63dc73cb4464d0cef3d7 (diff)
downloadgenenetwork2-c5c5de8aa9a8078ba5d955f2fc22dbc2c2494610.tar.gz
Added something that should work as a 'universal' solution for decoding trait descriptions in search results, since there were still some traits with encoding issues
-rw-r--r--wqflask/wqflask/search_results.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index dd360971..cf2905c9 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -5,6 +5,7 @@ import time
import re
import requests
from types import SimpleNamespace
+import unicodedata
from pprint import pformat as pf
@@ -122,7 +123,7 @@ class SearchResultPage:
trait_dict['symbol'] = "N/A" if result[3] is None else result[3].strip()
description_text = ""
if result[4] is not None and str(result[4]) != "":
- description_text = result[4].decode('utf-8')
+ description_text = unicodedata.normalize("NFKD", result[4].decode('latin1'))
target_string = result[5].decode('utf-8') if result[5] else ""
description_display = description_text if target_string is None or str(target_string) == "" else description_text + "; " + str(target_string).strip()