diff options
author | Timo Sirainen <cras@irssi.org> | 2002-02-15 14:42:14 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-02-15 14:42:14 +0000 |
commit | 9d1506ebca9f9c695b6a2d042fd93412a478256f (patch) | |
tree | f3ef711204f1a459652949f9471ccf93a38cc89e /src | |
parent | d0a9710bb82bdf068abfcb48d7f4c790178ec15e (diff) | |
download | irssi-9d1506ebca9f9c695b6a2d042fd93412a478256f.zip |
UTF-8 is now automatically used if locale is set properly.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2451 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-text/term.c | 15 |
1 files changed, 14 insertions, 1 deletions
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); |