diff options
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/fe-text/term.c | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/configure.in b/configure.in index 30ae246c..521b7021 100644 --- a/configure.in +++ b/configure.in @@ -205,7 +205,7 @@ case "$host_os" in esac -AC_CHECK_FUNCS(mkfifo fcntl) +AC_CHECK_FUNCS(mkfifo fcntl nl_langinfo) AC_CHECK_FUNC(socket, [], [ AC_CHECK_LIB(socket, socket, [ diff --git a/src/fe-text/term.c b/src/fe-text/term.c index 804157fb..9e9f1f04 100644 --- a/src/fe-text/term.c +++ b/src/fe-text/term.c @@ -26,6 +26,11 @@ #include "term.h" #include "mainwindows.h" +#ifdef HAVE_NL_LANGINFO +# include <locale.h> +# include <langinfo.h> +#endif + #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif @@ -100,7 +105,7 @@ static void read_settings(void) /* set terminal type */ str = settings_get_str("term_type"); - if (g_strcasecmp(str, "utf8") == 0) + if (g_strcasecmp(str, "utf-8") == 0) term_type = TERM_TYPE_UTF8; else if (g_strcasecmp(str, "big5") == 0) term_type = TERM_TYPE_BIG5; @@ -137,6 +142,14 @@ void term_common_init(void) term_use_colors = term_has_colors() && settings_get_bool("colors"); read_settings(); +#ifdef HAVE_NL_LANGINFO + setlocale(LC_CTYPE, ""); + if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) { + term_type = TERM_TYPE_UTF8; + term_set_input_type(TERM_TYPE_UTF8); + } +#endif + signal_add("beep", (SIGNAL_FUNC) term_beep); signal_add("setup changed", (SIGNAL_FUNC) read_settings); command_bind("resize", NULL, (SIGNAL_FUNC) cmd_resize); |