diff --git a/tests/data/test557 b/tests/data/test557
index 123bbeade3..ad9350f6e2 100644
--- a/tests/data/test557
+++ b/tests/data/test557
@@ -15,10 +15,6 @@ unittest
none
-
-LC_ALL=
-LC_NUMERIC=C
-
# tool is what to use instead of 'curl'
lib557
diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c
index 68fdfa2b1f..ca3118aec2 100644
--- a/tests/libtest/lib557.c
+++ b/tests/libtest/lib557.c
@@ -26,8 +26,12 @@
*/
#include "test.h"
-#include "memdebug.h"
+#ifdef HAVE_LOCALE_H
+# include /* for setlocale() */
+#endif
+
+#include "memdebug.h"
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
# define MPRNT_SUFFIX_CURL_OFF_T LL
@@ -1656,6 +1660,14 @@ int test(char *URL)
int errors = 0;
(void)URL; /* not used */
+#ifdef HAVE_SETLOCALE
+ /*
+ * The test makes assumptions about the numeric locale (specifically,
+ * RADIXCHAR) so set it to a known working (and portable) one.
+ */
+ setlocale(LC_NUMERIC, "C");
+#endif
+
errors += test_weird_arguments();
errors += test_unsigned_short_formatting();