diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-06-05 07:22:23 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-06-05 07:22:23 +0000 |
commit | 18665b8cc90904db87c454346a3234488bb6a813 (patch) | |
tree | 46a5be48008d82153161812b25dd7f4a0c981166 /tmux.c | |
parent | a3c32841e631590d26884731acd8f44a32516054 (diff) | |
download | rtmux-18665b8cc90904db87c454346a3234488bb6a813.tar.gz rtmux-18665b8cc90904db87c454346a3234488bb6a813.tar.bz2 rtmux-18665b8cc90904db87c454346a3234488bb6a813.zip |
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.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -326,12 +326,17 @@ main(int argc, char **argv) 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 * if not they know that output from UTF-8-capable programs may * 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; } |