r4123: set locale to C to ensure ascii string functions work
authorAndrew Tridgell <tridge@samba.org>
Fri, 10 Dec 2004 03:41:54 +0000 (03:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:06:28 +0000 (13:06 -0500)
thanks to Bjoern JACKE <samba@j3e.de> for pointing this out
(This used to be commit 53c4d0a7d83181afbe01bbbb0840cb2a086b45da)

source4/build/m4/rewrite.m4
source4/lib/charcnv.c

index ee73451697f002ab93ee855b96436317fb1a55da..e9a59a4012aa3c26ce8709e6337c39c7ade4d095 100644 (file)
@@ -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
index bfb1081474c655ec5d6d58bafcb2c81d4b8a4334..fc1f511403dafc1f417c73561f56b4b116def8e0 100644 (file)
@@ -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);
        }