# HG changeset patch # User Mikael Berthe # Date 1196597097 -3600 # Node ID 1447c52969771db9a905a9ba9e4367dd6e1334a0 # Parent 40095d413da916afc00bc7b7ad3655dbe84327de 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. diff -r 40095d413da9 -r 1447c5296977 mcabber/configure.ac --- a/mcabber/configure.ac Sun Dec 02 10:36:42 2007 +0100 +++ b/mcabber/configure.ac Sun Dec 02 13:04:57 2007 +0100 @@ -33,7 +33,8 @@ AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \ stdlib.h string.h strings.h sys/socket.h sys/time.h \ - syslog.h termios.h unistd.h getopt.h wchar.h wctype.h]) + syslog.h termios.h unistd.h getopt.h wchar.h wctype.h \ + localcharset.h]) AC_CHECK_HEADERS([getopt.h], , AC_MSG_ERROR([Missing header file])) AC_VAR_TIMEZONE_EXTERNALS @@ -189,7 +190,7 @@ # Export $datadir to the source tree. if test x"${datadir}" != x""; then - AC_DEFINE_DIR(DATA_DIR, "$datadir", [Data files directory]) + AC_DEFINE_DIR(DATA_DIR, "${datadir}", [Data files directory]) fi AC_ARG_ENABLE(debug, diff -r 40095d413da9 -r 1447c5296977 mcabber/src/screen.c --- 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 #include #include + +#include #include -#include -#include #include +#ifdef HAVE_LOCALCHARSET_H +# include +#else +# include +#endif + #ifdef HAVE_ASPELL_H # include #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); }