diff --git a/auth.py b/auth.py index 2ca3b683..ab0b9110 100644 --- a/auth.py +++ b/auth.py @@ -36,7 +36,7 @@ def createBasicAuthHeader(nickname: str,password: str) -> str: """This is only used by tests """ authStr=nickname.replace('\n','')+':'+password.replace('\n','') - return 'Basic '+base64.b64encode(authStr.encode('utf8')).decode('utf8') + return 'Basic '+base64.b64encode(authStr.encode('utf-8')).decode('utf-8') def authorizeBasic(baseDir: str,authHeader: str) -> bool: """HTTP basic auth @@ -44,7 +44,7 @@ def authorizeBasic(baseDir: str,authHeader: str) -> bool: if ' ' not in authHeader: return False base64Str = authHeader.split(' ')[1].replace('\n','') - plain = base64.b64decode(base64Str).decode('utf8') + plain = base64.b64decode(base64Str).decode('utf-8') if ':' not in plain: return False nickname = plain.split(':')[0] diff --git a/daemon.py b/daemon.py index cc5f9030..3688ec52 100644 --- a/daemon.py +++ b/daemon.py @@ -177,10 +177,10 @@ class PubServer(BaseHTTPRequestHandler): filename=self.server.baseDir+self.path if os.path.isfile(filename): self._set_headers('application/json') - with open(filename, 'r', encoding='utf8') as File: + with open(filename, 'r', encoding='utf-8') as File: content = File.read() contentJson=json.loads(content) - self.wfile.write(json.dumps(contentJson).encode('utf8')) + self.wfile.write(json.dumps(contentJson).encode('utf-8')) else: if self.server.debug: print('DEBUG: GET Unknown file')