diff --git a/contextualSpellCheck/contextualSpellCheck.py b/contextualSpellCheck/contextualSpellCheck.py index 62e2a91..d547f62 100755 --- a/contextualSpellCheck/contextualSpellCheck.py +++ b/contextualSpellCheck/contextualSpellCheck.py @@ -92,7 +92,7 @@ def __init__( debug_file_path = os.path.join( current_path, "tests", "debugFile.txt" ) - with open(debug_file_path, "w+") as new_file: + with open(debug_file_path, "w+", encoding="utf8") as new_file: new_file.write("\n".join(words)) print("Final vocab at " + debug_file_path) diff --git a/contextualSpellCheck/tests/test_contextualSpellCheck.py b/contextualSpellCheck/tests/test_contextualSpellCheck.py index aa33306..1280380 100644 --- a/contextualSpellCheck/tests/test_contextualSpellCheck.py +++ b/contextualSpellCheck/tests/test_contextualSpellCheck.py @@ -593,8 +593,8 @@ def test_vocab_file(): ContextualSpellCheck( nlp, "contextualSpellCheck", vocab_path=testVocab, debug=True ) - with open(orgDebugFilePath) as f1: - with open(debugPathFile) as f2: + with open(orgDebugFilePath, encoding="utf8") as f1: + with open(debugPathFile, encoding="utf8") as f2: assert f1.read() == f2.read()