Bug in config parser

Hue: 4.10.0

Language specific characters and unicode hyphen (which almost always looks like old good minus) in hive config makes hue unable to fully/correctly start/display main page.

[root@hue-2 conf]# grep hive_conf_dir /etc/hue/hue-4.10.0/hue.ini
  hive_conf_dir=/etc/hive/conf
[root@hue-2 conf]# 

[root@hue-2 conf]# pwd
/etc/hive/conf
[root@hue-2 conf]# perl -ne 'print "$. $_" if m/[\x80-\xFF]/' hive-site.xml-full 
8 <!-- hive ogólne start -->
187 <!-- hive ogólne koniec -->
255     <description>Default Value: mr (deprecated in Hive 2.0.0 – see below)
471 <!-- nie działa
506       NONE: no authentication check – plain SASL transport
708       single sourced not having any subquery and should not have any aggregations or distincts (which incur RS – 
715       (UDTFs and lateral views are not yet supported – see HIVE-5718.)
801     <description>Nie mam pojęcia do czego to służy</description>
[root@hue-2 conf]#

web page screenshot:

These characters are not a problem for hive, which works just fine.

in runcpserver.log you can find one related error msg:

[18/Aug/2022 12:46:44 +0200] log          INFO     OK: /desktop/globalJsConstants.js
Traceback (most recent call last):
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/usr/share/hue/desktop/core/src/desktop/views.py", line 403, in global_js_constants
    'layer_options': json.dumps(desktop.conf.LEAFLET_TILE_LAYER_OPTIONS.get()),
  File "/usr/share/hue/desktop/core/src/desktop/lib/django_util.py", line 248, in render
    **kwargs
  File "/usr/share/hue/desktop/core/src/desktop/lib/django_util.py", line 161, in _render_to_response
    return django_mako.render_to_response(template, *args, **kwargs)
  File "/usr/share/hue/desktop/core/src/desktop/lib/django_mako.py", line 127, in render_to_response
    return HttpResponse(render_to_string(template_name, data_dictionary), **kwargs)
  File "/usr/share/hue/desktop/core/src/desktop/lib/django_mako.py", line 116, in render_to_string_normal
    result = template.render(**data_dict)
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/mako/template.py", line 473, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/mako/runtime.py", line 883, in _render
    **_kwargs_for_callable(callable_, data)
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/share/hue/build/env/lib/python3.6/site-packages/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "/tmp/tmpm9n7q194/desktop/global_js_constants.mako.py", line 111, in render_body
    __M_writer(escape(str( get_cluster_config(user)['has_computes'] )))
  File "/usr/share/hue/desktop/core/src/desktop/models.py", line 1725, in get_cluster_config
    return Cluster(user).get_app_config().get_config()
  File "/usr/share/hue/desktop/core/src/desktop/models.py", line 1743, in get_config
    app_config = self.get_apps()
  File "/usr/share/hue/desktop/core/src/desktop/models.py", line 1775, in get_apps
    ('editor', self._get_editor()),
  File "/usr/share/hue/desktop/core/src/desktop/models.py", line 1834, in _get_editor
    _interpreters = get_ordered_interpreters(self.user)
  File "/usr/share/hue/desktop/libs/notebook/src/notebook/conf.py", line 99, in get_ordered_interpreters
    _default_interpreters(none_user)
  File "/usr/share/hue/desktop/libs/notebook/src/notebook/conf.py", line 301, in _default_interpreters
    interpreter_name = 'Impala' if get_hive_execution_engine() == 'impala' else 'Hive'  # Until using a proper dialect for 'FENG'
  File "/usr/share/hue/apps/beeswax/src/beeswax/hive_site.py", line 212, in get_hive_execution_engine
    return get_conf().get(_CNF_HIVE_EXECUTION_ENGINE)
  File "/usr/share/hue/apps/beeswax/src/beeswax/hive_site.py", line 93, in get_conf
    _parse_hive_site()
  File "/usr/share/hue/apps/beeswax/src/beeswax/hive_site.py", line 223, in _parse_hive_site
    data = open_file(_HIVE_SITE_PATH, 'r').read()
  File "/usr/share/hue/build/env/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 21275: ordinal not in range(128)
:

After replacing problematic characters with the closest ascii equivalents, hue works without problems.