Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: allow emojis in reana-ui announcement #677

Open
mdonadoni opened this issue Mar 13, 2024 · 0 comments
Open

config: allow emojis in reana-ui announcement #677

mdonadoni opened this issue Mar 13, 2024 · 0 comments

Comments

@mdonadoni
Copy link
Member

Trying to put emojis in the reana-ui announcement results in the following error:

  File "/code/./reana_server/rest/config.py", line 75, in get_config
    jsonify(REANAConfig.load("ui")),
  File "/usr/local/lib/python3.8/dist-packages/reana_commons/config.py", line 40, in load
    return cls._read_file(cls.config_mapping[kind])
  File "/usr/local/lib/python3.8/dist-packages/reana_commons/config.py", line 30, in _read_file
    data = yaml.load(yaml_file, Loader=yaml.FullLoader)
  File "/usr/local/lib/python3.8/dist-packages/yaml/__init__.py", line 79, in load
    loader = Loader(stream)
  File "/usr/local/lib/python3.8/dist-packages/yaml/loader.py", line 24, in __init__
    Reader.__init__(self, stream)
  File "/usr/local/lib/python3.8/dist-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/usr/local/lib/python3.8/dist-packages/yaml/reader.py", line 124, in determine_encoding
    self.update_raw()
  File "/usr/local/lib/python3.8/dist-packages/yaml/reader.py", line 178, in update_raw
    data = self.stream.read(size)
  File "/usr/lib/python3.8/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 38: ordinal not in range(128)

Probably a locale-related issue, as inside the reana-server's pod the default locale is POSIX:

$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Note that manually modifying the ConfigMap removing the Unicode character and adding its escaped counterpart works well. However, I haven't found a way to make Helm maintain the escaped sequence when generating the ConfigMap.

From:

apiVersion: v1
data:
  ui-config.yaml: |
    announcement: "Trying out some emojis ⭐"
...

To:

apiVersion: v1
data:
  ui-config.yaml: |
    announcement: "Trying out some emojis \u2B50"
...

@mdonadoni mdonadoni changed the title config: allow emoji in reana-ui announcement config: allow emojis in reana-ui announcement Mar 13, 2024
@mdonadoni mdonadoni added this to 0.95.0 Aug 8, 2024
@mdonadoni mdonadoni moved this to Backlog in 0.95.0 Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant