aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2014-01-05 18:23:46 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2014-01-05 18:23:46 +0000
commitd97617963d828eca189feeeaa0a41f4b6eb76257 (patch)
tree1c19e0a7372eb0200a306d98aab509f53c9908fe
parent8bed1fdbf03cc72689f57cd637465a3ca2b4c8e2 (diff)
downloadtermo-d97617963d828eca189feeeaa0a41f4b6eb76257.tar.gz
termo-d97617963d828eca189feeeaa0a41f4b6eb76257.tar.xz
termo-d97617963d828eca189feeeaa0a41f4b6eb76257.zip
Look for \.UTF-8 only in the first env. var found from LANG, LC_MESSAGES, LC_ALL
-rw-r--r--termkey.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/termkey.c b/termkey.c
index 4239c66..cad511f 100644
--- a/termkey.c
+++ b/termkey.c
@@ -382,19 +382,10 @@ TermKey *termkey_new(int fd, int flags)
tk->fd = fd;
if(!(flags & (TERMKEY_FLAG_RAW|TERMKEY_FLAG_UTF8))) {
- int locale_is_utf8 = 0;
char *e;
- if((e = getenv("LANG")) && strstr(e, "UTF-8"))
- locale_is_utf8 = 1;
-
- if(!locale_is_utf8 && (e = getenv("LC_MESSAGES")) && strstr(e, "UTF-8"))
- locale_is_utf8 = 1;
-
- if(!locale_is_utf8 && (e = getenv("LC_ALL")) && strstr(e, "UTF-8"))
- locale_is_utf8 = 1;
-
- if(locale_is_utf8)
+ if(((e = getenv("LANG")) || (e = getenv("LC_MESSAGES")) || (e = getenv("LC_ALL"))) &&
+ strstr(e, "UTF-8"))
flags |= TERMKEY_FLAG_UTF8;
else
flags |= TERMKEY_FLAG_RAW;