Applications requiring UTF-8 fail
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
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:/
2. Change the application itself to fallback to "C.UTF-8": https:/
3. Setting LC_ALL to "C.UTF-8" in snapcraft.yaml (either using `environment` or by prefixing the command string): https:/
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/
cli(obj={}) #pylint: disable=E1123,E1120
File "/snap/
return self.main(*args, **kwargs)
File "/snap/
_verify_
File "/snap/
' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https:/
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:/
description: | updated |
Another way.
apps:
pipenv:
environment:
# I don't know what I am doing
LC_ALL: C.UTF-8
LANG: C.UTF-8
command: bin/pipenv