Fix UnicodeDecodeError reading dashboard index.html on Windows

read_text() defaults to the platform locale encoding (cp1252 on
Windows), which fails on non-ASCII bytes in index.html. Specify
utf-8 explicitly.
This commit is contained in:
Claude 2026-07-05 20:30:21 +00:00
parent 98e33ca0c0
commit e05a065c4e
1 changed files with 1 additions and 1 deletions

View File

@ -1251,7 +1251,7 @@ if dashboard_dir.exists():
def index():
html_file = BASE_DIR / "dashboard" / "index.html"
if html_file.exists():
content = html_file.read_text()
content = html_file.read_text(encoding="utf-8")
content = content.replace('href="styles.css"', 'href="/dashboard/styles.css"')
content = content.replace('src="utils.js"', 'src="/dashboard/utils.js"')
content = content.replace('src="api.js"', 'src="/dashboard/api.js"')