mirror of
https://github.com/9001/copyparty.git
synced 2025-11-06 06:43:53 +00:00
config-loader: support utf8-bom
This commit is contained in:
@@ -658,6 +658,9 @@ def read_utf8(log: Optional["NamedLogger"], ap: Union[str, bytes], strict: bool)
|
|||||||
with open(ap, "rb") as f:
|
with open(ap, "rb") as f:
|
||||||
buf = f.read()
|
buf = f.read()
|
||||||
|
|
||||||
|
if buf.startswith(b"\xef\xbb\xbf"):
|
||||||
|
buf = buf[3:]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return buf.decode("utf-8", "strict")
|
return buf.decode("utf-8", "strict")
|
||||||
except UnicodeDecodeError as ex:
|
except UnicodeDecodeError as ex:
|
||||||
|
|||||||
Reference in New Issue
Block a user