Applications requiring UTF-8 fail
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
UTF-8 support in snapcraft is still quite poor. For example, Python applications requiring UTF-8 fail on most systems because the snap only contains `C.UTF-8`, not the locale of the host machine. As a result, python seems to fallback to ASCII, breaking many libraries.
Existing python snaps solve this in a number of ways:
1. A wrapper script that sets LC_ALL to "C.UTF-8": https://github.com/juju/charm-tools/blob/c3cee3672978d19cb66b7a301c0fbae9542eb58d/helpers/snap-wrappers/charm#L8
2. Change the application itself to fallback to "C.UTF-8": https://github.com/snapcore/snapcraft/blob/4042556714400d2156cb89efb86bf294500d1f41/snapcraft/cli/__main__.py#L40
3. Setting LC_ALL to "C.UTF-8" in snapcraft.yaml (either using `environment` or by prefixing the command string): https://github.com/warner/magic-wormhole/blob/13102d3eeded33a4ad749078de9bbca5000ffbe6/snapcraft.yaml#L22
Since so many people have this issue, would it be possible to provide a fix for it in snapcraft?
Below you can find an example for the click library failing because the locale fallsback to ASCII.
```
Traceback (most recent call last):
File "/snap/gh-teacher/x4/bin/gh-tools", line 172, in <module>
cli(obj={}) #pylint: disable=E1123,E1120
File "/snap/gh-teacher/x4/lib/python3.5/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/snap/gh-teacher/x4/lib/python3.5/site-packages/click/core.py", line 696, in main
_verify_python3_env()
File "/snap/gh-teacher/x4/lib/python3.5/site-packages/click/_unicodefun.py", line 124, in _verify_python3_env
' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Click discovered that you exported a UTF-8 locale
but the locale system could not pick up from it because
it does not exist. The exported locale is "en_US.UTF-8" but it
is not supported
```
Related bug in snapcraft itself: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1576411
Evaluation history
No evaluation history available.