diff --git a/requirements.txt b/requirements.txt index eb62598..1aa8693 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ requests==2.27.1 smmap==3.0.4 Werkzeug==1.0.1 idna==3.3 -lxml==4.9.1 +lxml==4.9.2 Whoosh==2.7.4 watchdog==2.1.9 cachelib==0.6.0 diff --git a/search.py b/search.py index 3c063b9..f3d8062 100644 --- a/search.py +++ b/search.py @@ -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( @@ -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)