]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
unzip: explicitly set en_US.UTF-8 locale in test_I.c
authorMartin Matuska <martin@matuska.de>
Tue, 23 Apr 2024 05:45:50 +0000 (07:45 +0200)
committerMartin Matuska <martin@matuska.de>
Tue, 23 Apr 2024 05:45:50 +0000 (07:45 +0200)
unzip/test/test_I.c

index a6bad85a011f278e6fe423a4cf4e03f01da927fe..5d31ce8d1611f0463aae4f2c1915d01fe8604a30 100644 (file)
  */
 #include "test.h"
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
 /* Test I arg - file name encoding */
 DEFINE_TEST(test_I)
 {
        const char *reffile = "test_I.zip";
        int r;
 
+#if HAVE_SETLOCALE
+       if (NULL == setlocale(LC_ALL, "en_US.UTF-8")) {
+               skipping("en_US.UTF-8 locale not available on this system.");
+               return;
+       }
+#else
+       skipping("setlocale() not available on this system.");
+#endif
+
        extract_reference_file(reffile);
        r = systemf("%s -I UTF-8 %s >test.out 2>test.err", testprog, reffile);
        assertEqualInt(0, r);