Skip to content

Commit 58bbad6

Browse files
authored
Merge pull request jxmorris12#43 from bzm3r/master
Allow handling of utf-8 encoded files when registering new spellings
2 parents 424b2a6 + 1809abf commit 58bbad6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎language_tool_python/server.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ def _get_valid_spelling_file_path() -> str:
150150

151151
def _register_spellings(self, spellings):
152152
spelling_file_path = self._get_valid_spelling_file_path()
153-
with open(spelling_file_path, "a+") as spellings_file:
153+
with open(spelling_file_path, "a+", encoding='utf-8') as spellings_file:
154154
spellings_file.write("\n" + "\n".join([word for word in spellings]))
155155
if DEBUG_MODE:
156156
print("Registered new spellings at {}".format(spelling_file_path))
157157

158158
def _unregister_spellings(self):
159159
spelling_file_path = self._get_valid_spelling_file_path()
160-
with open(spelling_file_path, 'r+') as spellings_file:
160+
with open(spelling_file_path, 'r+', encoding='utf-8') as spellings_file:
161161
spellings_file.seek(0, os.SEEK_END)
162162
for _ in range(len(self._new_spellings)):
163163
while spellings_file.read(1) != '\n':

0 commit comments

Comments
 (0)