Mercurial > ~mikael > mcabber > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1381:40095d413da9 | 1382:1447c5296977 |
---|---|
23 #include <stdio.h> | 23 #include <stdio.h> |
24 #include <stdlib.h> | 24 #include <stdlib.h> |
25 #include <string.h> | 25 #include <string.h> |
26 #include <time.h> | 26 #include <time.h> |
27 #include <ctype.h> | 27 #include <ctype.h> |
28 | |
29 #include <config.h> | |
28 #include <locale.h> | 30 #include <locale.h> |
29 #include <langinfo.h> | |
30 #include <config.h> | |
31 #include <assert.h> | 31 #include <assert.h> |
32 | |
33 #ifdef HAVE_LOCALCHARSET_H | |
34 # include <localcharset.h> | |
35 #else | |
36 # include <langinfo.h> | |
37 #endif | |
32 | 38 |
33 #ifdef HAVE_ASPELL_H | 39 #ifdef HAVE_ASPELL_H |
34 # include <aspell.h> | 40 # include <aspell.h> |
35 #endif | 41 #endif |
36 | 42 |
732 } | 738 } |
733 | 739 |
734 void scr_InitLocaleCharSet(void) | 740 void scr_InitLocaleCharSet(void) |
735 { | 741 { |
736 setlocale(LC_CTYPE, ""); | 742 setlocale(LC_CTYPE, ""); |
743 #ifdef HAVE_LOCALCHARSET_H | |
744 LocaleCharSet = locale_charset(); | |
745 #else | |
737 LocaleCharSet = nl_langinfo(CODESET); | 746 LocaleCharSet = nl_langinfo(CODESET); |
747 #endif | |
738 utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0); | 748 utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0); |
739 } | 749 } |
740 | 750 |
741 void scr_InitCurses(void) | 751 void scr_InitCurses(void) |
742 { | 752 { |