Commit graph

1 commit

Author SHA1 Message Date
supermario_leo
2f1538a641 fix: decode/encode owned config, state and template assets as UTF-8
Headroom reads and writes its own dashboard template, JSON deployment/sync
state and provider config files using the platform default text codec. On
systems whose default encoding is not UTF-8 (e.g. Windows cp949/cp1252
locales) this raises UnicodeDecodeError when the file contains non-ASCII
bytes.

The dashboard template ships with non-ASCII UTF-8 content, so loading the
dashboard crashes on a Korean Windows locale at byte 20523 (fixes #533).
The same latent bug exists in the sibling JSON state/config I/O; since these
files are owned by Headroom and JSON is UTF-8 by spec (RFC 8259 §8.1), read
and write them with an explicit encoding="utf-8" so they round-trip on every
platform.

Add a regression test covering the dashboard load and a non-ASCII JSON
state round-trip.
2026-06-03 03:25:42 +08:00