aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--tmux.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 8f080ec2..500fc30d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
19 May 2009
+* 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.
* New window option: monitor-content. Searches for a string in a window and if
it matches, highlight the status line.
@@ -1275,7 +1278,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.293 2009-05-19 13:32:55 tcunha Exp $
+$Id: CHANGES,v 1.294 2009-05-19 16:03:18 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
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') {