diff mcabber/src/screen.c @ 1382:1447c5296977

Fix locale charset detection on some BSD systems Tested on OpenBSD 4.2 If possible, use locale_charset() in place of nl_langinfo(). This patch also reverts the minor datadir change from last changeset as it doesn't solve the problem.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 02 Dec 2007 13:04:57 +0100
parents 40095d413da9
children 8e763c2c331f
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sun Dec 02 10:36:42 2007 +0100
+++ b/mcabber/src/screen.c	Sun Dec 02 13:04:57 2007 +0100
@@ -25,11 +25,17 @@
 #include <string.h>
 #include <time.h>
 #include <ctype.h>
+
+#include <config.h>
 #include <locale.h>
-#include <langinfo.h>
-#include <config.h>
 #include <assert.h>
 
+#ifdef HAVE_LOCALCHARSET_H
+# include <localcharset.h>
+#else
+# include <langinfo.h>
+#endif
+
 #ifdef HAVE_ASPELL_H
 # include <aspell.h>
 #endif
@@ -734,7 +740,11 @@
 void scr_InitLocaleCharSet(void)
 {
   setlocale(LC_CTYPE, "");
+#ifdef HAVE_LOCALCHARSET_H
+  LocaleCharSet = locale_charset();
+#else
   LocaleCharSet = nl_langinfo(CODESET);
+#endif
   utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0);
 }