cli: use C.UTF-8 if locale not set
Metadata
Current evaluation
Merged #1893 in commit 0d5b88a41, adding a C.UTF-8 fallback when no locale is set so Click no longer fails in Docker, LXD, and CI.
Resolution: closed resolved
Reason: The approved change was merged as commit 0d5b88a41, resolving LP bug #1746100 by using C.UTF-8 when the locale is unset.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
When running Snapcraft in a specific way (e.g. Docker, LXD) it's possible to have a situation where no locale is set. This happens mostly in CI systems. Click raises a `RuntimeError` in this situation, which is a pretty terrible user experience.
This PR fixes LP: [#1746100](https://bugs.launchpad.net/snapcraft/+bug/1746100) by using C.UTF-8 by default if it's is available This will allow Snapcraft to run on these systems without creating more work for our users.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #1893 in commit 0d5b88a41, adding a C.UTF-8 fallback when no locale is set so Click no longer fails in Docker, LXD, and CI. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #1893 (commit 0d5b88a41), adding a C.UTF-8 fallback when no locale is set, preventing Click locale errors in Docker, LXD, and CI. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix defaulting to C.UTF-8 when locale is unset, preventing Click RuntimeError in CI and containers. Approved by reviewer, passed CI, and resolves Launchpad bug #1746100. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix defaulting to C.UTF-8 locale when unset, preventing Click RuntimeError in CI and containerized environments. Resolves Launchpad bug #1746100. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1310 tests: use C.UTF-8 for the docker locale | snapcraft | merged | Merged #1310 (commit 45acbf0be), changing Docker test locale settings to C.UTF-8; coverage remained unchanged. |