summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/RobolectricNativeRuntime.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/jni/RobolectricNativeRuntime.cpp b/core/jni/RobolectricNativeRuntime.cpp
index d11a4b71ecef..fcbc89e788fb 100644
--- a/core/jni/RobolectricNativeRuntime.cpp
+++ b/core/jni/RobolectricNativeRuntime.cpp
@@ -4,6 +4,7 @@
#include <vector>
#include <android/graphics/jni_runtime.h>
+#include <locale.h>
#include <sys/stat.h>
#include <unicode/putil.h>
#include <unicode/udata.h>
@@ -214,5 +215,10 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
}
env->ReleaseStringUTFChars(stringPath, icuPath);
env->ReleaseStringUTFChars(stringLanguageTag, languageTag);
+
+ // Use minimal "C" locale for number format to ensure correct parsing of floats when using
+ // strtof (e.g. in PathParser).
+ setlocale(LC_NUMERIC, "C");
+
return JNI_VERSION_1_6;
}