summaryrefslogtreecommitdiffstats
path: root/src/rcclocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rcclocale.c')
-rw-r--r--src/rcclocale.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rcclocale.c b/src/rcclocale.c
index 99d2b8f..9869a72 100644
--- a/src/rcclocale.c
+++ b/src/rcclocale.c
@@ -5,10 +5,14 @@
#include "../config.h"
+#ifdef HAVE_LIBCHARSET
+# include <libcharset.h>
+#endif /* HAVE_LIBCHARSET */
#ifdef HAVE_CODESET
# include <langinfo.h>
#endif
+
#include "rccconfig.h"
int rccLocaleGetClassByName(const char *locale) {
@@ -80,9 +84,12 @@ int rccLocaleGetCharset(char *result, const char *lv, unsigned int n) {
if (locale_class == LC_CTYPE) {
l = getenv("CHARSET");
+#ifdef HAVE_LIBCHARSET
+ if (!l) l = locale_charset();
+#endif /* HAVE_LIBCHARSET */
#ifdef HAVE_CODESET
if (!l) l = nl_langinfo(CODESET);
-#endif
+#endif /* HAVE_CODESET */
if (l) {
if (strlen(l)>=n) return -1;
strcpy(result, l);