#include <errno.h>
#include <fcntl.h>
-#include <langinfo.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef __WIN32__
# include "win32.h"
+#else
+# include <langinfo.h>
#endif
#include "buffer_io.h"
DEBUG("Freed WIMStruct");
}
-bool wimlib_mbs_is_utf8;
+static bool
+test_locale_ctype_utf8()
+{
+ char *ctype = nl_langinfo(CODESET);
+
+ return (strstr(ctype, "UTF-8") == 0 ||
+ strstr(ctype, "UTF8") == 0 ||
+ strstr(ctype, "utf8") == 0 ||
+ strstr(ctype, "utf-8") == 0);
+}
/* Get global memory allocations out of the way. Not strictly necessary in
* single-threaded programs like 'imagex'. */
#ifdef WITH_NTFS_3G
libntfs3g_global_init();
#endif
- wimlib_mbs_is_utf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0);
+ wimlib_mbs_is_utf8 = test_locale_ctype_utf8();
return 0;
}