From a39edc87bbc0af0604391c45f3ac7498889c860e Mon Sep 17 00:00:00 2001 From: "Brian D. Caruso" Date: Fri, 10 Nov 2023 21:16:51 -0500 Subject: [PATCH] Fixes errors related to "could not decode" bad surrogate. --- accounts/wsgi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accounts/wsgi.py b/accounts/wsgi.py index 6a4dc1c4..b6eddb22 100644 --- a/accounts/wsgi.py +++ b/accounts/wsgi.py @@ -14,7 +14,10 @@ def application(environ, start_response): # type: ignore # in config.py or via an os.environ var loaded by config.py. if key == 'SERVER_NAME': continue - os.environ[key] = str(value) + try: + os.environ[key] = str(value) + except UnicodeEncodeError as uee: + print(f"{__file__} Could not decode bytes '{value}' for '{key}' most likely due to a surrogate. {uee}") global __flask_app__ if __flask_app__ is None: