From cc8a3400f1a719479d041f18a2ea6479c36e9e85 Mon Sep 17 00:00:00 2001 From: flavien-hugs Date: Sun, 11 Aug 2024 20:28:58 +0000 Subject: [PATCH] fix encoding --- src/shared/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/utils.py b/src/shared/utils.py index c284fad..489616e 100644 --- a/src/shared/utils.py +++ b/src/shared/utils.py @@ -71,7 +71,7 @@ def init_blacklist_token_file(self) -> bool: async def add_blacklist_token(self, token: str) -> bool: try: - with open(file=self._token_file, mode="a") as file: + with open(file=self._token_file, mode="a", encoding="utf-8") as file: file.write(f"{token},") logger.info("Adding token to blacklist file !") except IOError as e: @@ -80,7 +80,7 @@ async def add_blacklist_token(self, token: str) -> bool: async def is_token_blacklisted(self, token: str) -> bool: try: - with open(file=self._token_file) as file: + with open(file=self._token_file, encoding="utf-8") as file: content = file.read() tokens = content.rstrip(",").split(",") logger.info("The token already exists in the blacklist !")