aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-05-19 16:03:18 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-05-19 16:03:18 +0000
commit5db59a0d20d45d7dd961acdd0fc56714041cab55 (patch)
tree8b1aab7eb3c23d49475dd4ec61f243e23dd2c6f8 /tmux.c
parent80af85a102bcb4c91d6ce08102131a4654212d80 (diff)
downloadrtmux-5db59a0d20d45d7dd961acdd0fc56714041cab55.tar.gz
rtmux-5db59a0d20d45d7dd961acdd0fc56714041cab55.tar.bz2
rtmux-5db59a0d20d45d7dd961acdd0fc56714041cab55.zip
If LANG contains "UTF-8", assume the terminal supports UTF-8, on the grounds that anyone who configures it probably wants UTF-8. Not certain if this is a perfect idea but let's see if it causes any problems.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tmux.c b/tmux.c
index 67231221..13787ceb 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.120 2009-05-19 13:32:55 tcunha Exp $ */
+/* $Id: tmux.c,v 1.121 2009-05-19 16:03:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -223,7 +223,7 @@ main(int argc, char **argv)
struct hdr hdr;
const char *shell;
struct passwd *pw;
- char *path, *label, *cause, *home, *pass = NULL;
+ char *s, *path, *label, *cause, *home, *pass = NULL;
char cwd[MAXPATHLEN];
int retcode, opt, flags, unlock, start_server;
@@ -336,6 +336,17 @@ main(int argc, char **argv)
options_set_number(&global_window_options, "xterm-keys", 0);
options_set_number(&global_window_options, "remain-on-exit", 0);
+ if (!(flags & IDENTIFY_UTF8)) {
+ /*
+ * If the user has set LANG 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)
+ flags |= IDENTIFY_UTF8;
+ }
+
if (cfg_file == NULL) {
home = getenv("HOME");
if (home == NULL || *home == '\0') {