From a709280cbf0bf5dbb62507f9829647862ef5f6bc Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Wed, 27 Apr 2022 21:48:09 +0200 Subject: [PATCH] Try to detect unsupported config file encoding The encoding detection is quite rudimentary, but should detect the default windows encoding in many cases. --- PFERD/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PFERD/config.py b/PFERD/config.py index 5635573..8f7e682 100644 --- a/PFERD/config.py +++ b/PFERD/config.py @@ -128,6 +128,8 @@ class Config: raise ConfigLoadError(path, "That's a directory, not a file") except PermissionError: raise ConfigLoadError(path, "Insufficient permissions") + except UnicodeDecodeError: + raise ConfigLoadError(path, "File is not encoded using UTF-8") def dump(self, path: Optional[Path] = None) -> None: """