gcharset: Document the CHARSET environment variable a bit

Users should probably never be setting this — instead, just add the
charset after a `.` in `LANGUAGE`/`LC_ALL`/`LC_*`/`LANG`.

I can’t find any reference (in `git log`, code comments, or man pages)
to this environment variable being standardised or documented or even
used anywhere outside GLib. Perhaps it should eventually be removed.

If anybody finds references as to why GLib checks `CHARSET`, this
comment can be updated in future.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2514
This commit is contained in:
Philip Withnall 2021-11-26 12:07:00 +00:00
parent 922df0c8e6
commit 7dc7b84a52

View File

@ -109,6 +109,12 @@ static gboolean
g_utf8_get_charset_internal (const char *raw_data,
const char **a)
{
/* Allow CHARSET to override the charset of any locale category. Users should
* probably never be setting this instead, just add the charset after a `.`
* in `LANGUAGE`/`LC_ALL`/`LC_*`/`LANG`. I cant find any reference (in
* `git log`, code comments, or man pages) to this environment variable being
* standardised or documented or even used anywhere outside GLib. Perhaps it
* should eventually be removed. */
const char *charset = g_getenv ("CHARSET");
if (charset && *charset)