From a82dc68655c5413865051a4091aafddcd21d837e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rajmund=20Hru=C5=A1ka?= <rajmund.hruska@cesnet.cz>
Date: Wed, 25 May 2022 14:20:16 +0200
Subject: [PATCH] Fix: Use correct encoding for the organization given by the
 environment variable. (Redmine issue: #7553)

---
 lib/hawat/blueprints/auth_env/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/hawat/blueprints/auth_env/__init__.py b/lib/hawat/blueprints/auth_env/__init__.py
index 63da4250f..ab81ff50c 100644
--- a/lib/hawat/blueprints/auth_env/__init__.py
+++ b/lib/hawat/blueprints/auth_env/__init__.py
@@ -214,12 +214,12 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, BaseRegisterView):
         # Try to fetch organization from server authentication headers (optional).
         while True:
             try:
-                item.organization = flask.request.environ['perunOrganizationName']
+                item.organization = flask.request.environ['perunOrganizationName'].encode("iso-8859-1").decode()
                 break
             except (KeyError, AttributeError):
                 pass
             try:
-                item.organization = flask.request.environ['o']
+                item.organization = flask.request.environ['o'].encode("iso-8859-1").decode()
                 break
             except (KeyError, AttributeError):
                 pass
-- 
GitLab