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.

This commit is contained in:
Nicholas Marriott 2009-05-19 16:03:18 +00:00
parent 80af85a102
commit 5db59a0d20
2 changed files with 17 additions and 3 deletions

View File

@ -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

15
tmux.c
View File

@ -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') {