fix(main): UnicodeDecodeError

File "T:\_GitHubProjects\Forks\crawl4ai\main.py", line 70, in read_index
    partials[filename[:-5]] = file.read()

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 149: illegal multibyte sequence
This commit is contained in:
QIN2DIM
2024-05-18 23:31:11 +08:00
parent bf00c26a83
commit 5cee084340
2 changed files with 3 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ async def read_index(request: Request):
for filename in os.listdir(partials_dir):
if filename.endswith(".html"):
with open(os.path.join(partials_dir, filename), "r") as file:
with open(os.path.join(partials_dir, filename), "r", encoding="utf8") as file:
partials[filename[:-5]] = file.read()
return templates.TemplateResponse("index.html", {"request": request, **partials})