config-loader: support utf8-bom

This commit is contained in:
ed 2025-09-23 20:00:45 +00:00
parent deb8a4a86e
commit 5e4ff90b1c

View file

@ -658,6 +658,9 @@ def read_utf8(log: Optional["NamedLogger"], ap: Union[str, bytes], strict: bool)
with open(ap, "rb") as f:
buf = f.read()
if buf.startswith(b"\xef\xbb\xbf"):
buf = buf[3:]
try:
return buf.decode("utf-8", "strict")
except UnicodeDecodeError as ex: