mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 19:39:04 +00:00
Check the first of LC_CTYPE, LC_ALL and LANG, rather than just the last, when
trying to decide about UTF-8, and use strcasestr. Reported by Geert Hendrickx.
This commit is contained in:
parent
a3c32841e6
commit
18665b8cc9
9
tmux.c
9
tmux.c
@ -326,12 +326,17 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (!(flags & IDENTIFY_UTF8)) {
|
if (!(flags & IDENTIFY_UTF8)) {
|
||||||
/*
|
/*
|
||||||
* If the user has set LANG to contain UTF-8, it is a safe
|
* If the user has set whichever of LC_ALL, LC_CTYPE or LANG
|
||||||
|
* exist (in that order) to contain UTF-8, it is a safe
|
||||||
* assumption that either they are using a UTF-8 terminal, or
|
* assumption that either they are using a UTF-8 terminal, or
|
||||||
* if not they know that output from UTF-8-capable programs may
|
* if not they know that output from UTF-8-capable programs may
|
||||||
* be wrong.
|
* be wrong.
|
||||||
*/
|
*/
|
||||||
if ((s = getenv("LANG")) != NULL && strstr(s, "UTF-8") != NULL)
|
if ((s = getenv("LC_CTYPE")) == NULL) {
|
||||||
|
if ((s = getenv("LC_ALL")) == NULL)
|
||||||
|
s = getenv("LANG");
|
||||||
|
}
|
||||||
|
if (s != NULL && strcasestr(s, "UTF-8") != NULL)
|
||||||
flags |= IDENTIFY_UTF8;
|
flags |= IDENTIFY_UTF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user