Skip to content

Commit

Permalink
[Units] Suppress UnicodeEncodeError in check_answer function
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Oct 7, 2023
1 parent 961507d commit 4ccc58b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion units/trivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def check_answer(*, answer, response, clue = None, inflect_engine = None):
if character in response:
response = response.replace(character, "")
# Fix wrong encoding
with contextlib.suppress(UnicodeDecodeError):
with contextlib.suppress(UnicodeDecodeError, UnicodeEncodeError):
answer = answer.encode("ISO-8859-1").decode("UTF-8")
# Remove diacritics
answer = "".join(
Expand Down

0 comments on commit 4ccc58b

Please sign in to comment.