YAML: Force all files to open with utf8

The default encoding method when opening files on Windows is cp1252
which doesn't support all unicode and can cause issues.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-11-29 22:04:29 -05:00
parent 3957316b79
commit 2bc3da0155
2 changed files with 3 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ auth_keys: Optional[AuthKeys] = None
def load_auth_keys():
global auth_keys
try:
with open("api_tokens.yml", "r") as auth_file:
with open("api_tokens.yml", "r", encoding = 'utf8') as auth_file:
auth_keys_dict = yaml.safe_load(auth_file)
auth_keys = AuthKeys(
api_key = auth_keys_dict["api_key"],
@@ -44,7 +44,7 @@ def load_auth_keys():
)
auth_keys = new_auth_keys
with open("api_tokens.yml", "w") as auth_file:
with open("api_tokens.yml", "w", encoding = "utf8") as auth_file:
yaml.safe_dump(vars(auth_keys), auth_file, default_flow_style=False)
print(