summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-07-01 17:32:05 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-07-01 17:32:05 +0000
commitb38316c8ba9776b3db538dec6ab4faf83041b7f3 (patch)
tree1081df0236431ba76d87718a02df7f780c58134a
parent0c712801a030a59d23d59487a064718f03a61141 (diff)
downloadirssi-b38316c8ba9776b3db538dec6ab4faf83041b7f3.zip
Moved setlocale() at the beginning of initialization, should fix regexp
crashes with non-C locale. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2858 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-text/irssi.c9
-rw-r--r--src/fe-text/term.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index 9a5132dc..d0462aaa 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -42,6 +42,7 @@
#include "textbuffer-reformat.h"
#include <signal.h>
+#include <locale.h>
#ifdef HAVE_STATIC_PERL
void perl_core_init(void);
@@ -333,6 +334,14 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
#endif
+ /* setlocale() must be called at the beginning before any calls that
+ affect it, especially regexps seem to break if they're generated
+ before t his call.
+
+ locales aren't actually used for anything else than autodetection
+ of UTF-8 currently.. */
+ setlocale(LC_CTYPE, "");
+
textui_init();
args_register(options);
args_execute(argc, argv);
diff --git a/src/fe-text/term.c b/src/fe-text/term.c
index 03004b10..a36e68fa 100644
--- a/src/fe-text/term.c
+++ b/src/fe-text/term.c
@@ -27,7 +27,6 @@
#include "mainwindows.h"
#ifdef HAVE_NL_LANGINFO
-# include <locale.h>
# include <langinfo.h>
#endif
@@ -155,7 +154,6 @@ void term_common_init(void)
read_settings();
#if defined (HAVE_NL_LANGINFO) && defined(CODESET)
- setlocale(LC_CTYPE, "");
if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
term_type = TERM_TYPE_UTF8;
term_set_input_type(TERM_TYPE_UTF8);