mirror of
https://github.com/9001/copyparty.git
synced 2025-09-30 13:42:27 -06:00
config-loader: support utf8-bom
This commit is contained in:
parent
deb8a4a86e
commit
5e4ff90b1c
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue