microsoft / microsoft/vcpkg

[vcpkg] Set correct locale env variables.

Open
#43,293 7 comments 0 reactions 1 assignee Claimed by @JonLiu1993 View on GitHub
category:tool-update
Dominant language
CMake
Stars
27.5k
Forks
7.7k
Avg merge
2d 19h
Merged PRs (30d)
321

Description

vcpkg explicitly sets the env variable `LC_ALL=C.UTF-8`, see [here](https://github.com/microsoft/vcpkg-tool/blob/2025-01-11/src/vcpkg.cpp#L244-L257).
But a system may also has the env variable `LANGUAGE` set which takes precedence if `LC_ALL` has a value set different than `C`. Therefore, vcpkg may runs with a system default locale which is not the intended `C.UTF-8`. This can lead to problems if ports try to parse any tool output and do not properly handle locales by themself (e.g. #43291).

Therefore, vcpkg should probably also handle the `LANGUAGE` env variable in any way. Options:
- Unset `LANGUAGE`
- set to some explicit English default
- Set `LC_ALL=C` (but this will loose UTF-8)

References:
- [Ubuntu docs](https://help.ubuntu.com/community/EnvironmentVariables#The_LANGUAGE_priority_list)
- [gettext docs](https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html)

(This is a summary of a discussion with @BillyONeal on Discord starting [here](https://discord.com/channels/400588936151433218/687365466422902841/1329181698008678462).)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.