ignore unicode characters errors

+ add methods on settings.Keys to verify key !== empty string
This commit is contained in:
mungai-njoroge
2023-09-26 17:59:12 +03:00
parent 5cf0bb8c42
commit 54714a224b
5 changed files with 27 additions and 27 deletions
+2 -5
View File
@@ -1,8 +1,5 @@
def handle_unicode(string: str):
"""
Try resolving unicode characters, else escape them.
Handles Unicode errors by ignoring unicode characters
"""
return string.encode("utf-16", "replace").decode("utf-16")
# try:
# except:
# return string.encode("unicode_escape").decode("utf-8")
return string.encode("utf-16", "ignore").decode("utf-16")