summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/rewrite.m42
-rw-r--r--source4/lib/charcnv.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index ee73451697..e9a59a4012 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -424,6 +424,8 @@ AC_CHECK_FUNCS(syscall)
AC_CHECK_FUNCS(getdents)
AC_CHECK_FUNCS(pread pwrite)
+# needed for lib/charcnv.c
+AC_CHECK_FUNCS(setlocale)
#
# stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX
diff --git a/source4/lib/charcnv.c b/source4/lib/charcnv.c
index bfb1081474..fc1f511403 100644
--- a/source4/lib/charcnv.c
+++ b/source4/lib/charcnv.c
@@ -88,6 +88,17 @@ static smb_iconv_t get_conv_handle(charset_t from, charset_t to)
to look at */
if (initialised == 0) {
initialised = 1;
+
+#ifdef HAVE_SETLOCALE
+ /* we set back the locale to C to get ASCII-compatible
+ toupper/lower functions. For now we do not need
+ any other POSIX localisations anyway. When we
+ should really need localized string functions one
+ day we need to write our own ascii_tolower etc.
+ */
+ setlocale(LC_ALL, "C");
+#endif
+
atexit(init_iconv);
}