changeset 10570:63e1829bd757 octave-forge

Restore the locale after initializing the JVM (Sébastien Villemot)
author prnienhuis
date Fri, 20 Jul 2012 19:37:05 +0000
parents bb392deb832e
children 64a7c3bbdc42
files extra/java/src/__java__.cc
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/extra/java/src/__java__.cc	Fri Jul 20 19:33:59 2012 +0000
+++ b/extra/java/src/__java__.cc	Fri Jul 20 19:37:05 2012 +0000
@@ -34,6 +34,8 @@
 #include <iostream>
 #include <fstream>
 
+#include <clocale>
+
 typedef jint (JNICALL *JNI_CreateJavaVM_t) (JavaVM **pvm, JNIEnv **penv, void *args);
 typedef jint (JNICALL *JNI_GetCreatedJavaVMs_t) (JavaVM **pvm, jsize bufLen, jsize *nVMs);
 
@@ -385,6 +387,9 @@
 
   if (jvm) return;
 
+  const char *static_locale = setlocale(LC_ALL, NULL);
+  const std::string locale(static_locale);
+
 #if defined (__WIN32__)
 
   HMODULE hMod = GetModuleHandle("jvm.dll");
@@ -534,6 +539,8 @@
   }
 
 #endif
+
+  setlocale(LC_ALL, locale.c_str());
 }
 
 static void terminate_jvm(void)