Skip to content

Commit

Permalink
FIX utf-8 encoding on win
Browse files Browse the repository at this point in the history
  • Loading branch information
Mik3Rizzo committed Feb 25, 2023
1 parent c2632e6 commit cc1c53c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def index_all(self, wiki_directory: str, files: List[Tuple[str, str, str]]):
writer = AsyncWriter(self._index)
for path, title, relpath in files:
fpath = os.path.join(wiki_directory, relpath, path)
with open(fpath) as f:
with open(fpath, encoding="utf8") as f:
content = f.read()
content = self.textify(content)
writer.add_document(
Expand Down Expand Up @@ -126,7 +126,7 @@ def on_created(self, event: FileSystemEvent):
base_path, filename = os.path.split(file_path)
rel_path = self.rel_path(base_path)
title, _ = os.path.splitext(filename)
with open(file_path) as f:
with open(file_path, encoding="utf8") as f:
content = f.read()
self.search.index(rel_path, filename, title, content)

Expand Down

0 comments on commit cc1c53c

Please sign in to comment.