- reset locale when saving the config
- reset locale when saving the config
git-svn-id: https://lampka.siedziba.pl:790/svn/repos/lingot-win32@310 455248ca-bdda-0310-9134-f4ebb693071a
diff --git a/src/lingot-config.c b/src/lingot-config.c
index a46e372..9886ac8 100644
--- a/src/lingot-config.c
+++ b/src/lingot-config.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
+#include <locale.h>
#include "lingot-config.h"
#include "lingot-mainframe.h"
@@ -139,6 +140,12 @@ void lingot_config_save(LingotConfig* config, char* filename)
{
unsigned int i;
FILE* fp;
+ char* lc_all;
+
+ lc_all = setlocale(LC_ALL, NULL);
+// duplicate the string, as the next call to setlocale will destroy it
+ if (lc_all) lc_all = strdup(lc_all);
+ setlocale(LC_ALL, "POSIX");
if ((fp = fopen(filename, "w")) == NULL)
{
@@ -166,6 +173,11 @@ void lingot_config_save(LingotConfig* config, char* filename)
}
fclose(fp);
+
+ if (lc_all) {
+ setlocale(LC_ALL, lc_all);
+ free(lc_all);
+ }
}
//----------------------------------------------------------------------------