diff --git a/ckan/lib/app_globals.py b/ckan/lib/app_globals.py index 6b108d42a04..e98f975ca7d 100644 --- a/ckan/lib/app_globals.py +++ b/ckan/lib/app_globals.py @@ -109,9 +109,15 @@ def get_config_value(key, default=''): value = model.get_system_info(key) else: value = None + config_value = config.get(key) + # sort encodeings if needed + if isinstance(config_value, str): + try: + config_value = config_value.decode('utf-8') + except UnicodeDecodeError: + config_value = config_value.decode('latin-1') # we want to store the config the first time we get here so we can # reset them if needed - config_value = config.get(key) if key not in _CONFIG_CACHE: _CONFIG_CACHE[key] = config_value if value is not None: