summaryrefslogtreecommitdiffhomepage
path: root/src/lingot-config.c
diff options
context:
space:
mode:
authorpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2008-03-22 17:54:39 +0000
committerpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2008-03-22 17:54:39 +0000
commitb546bed0f6a69f82c4286583256826a08f467fa6 (patch)
treea231d37d6aa14d5f753c06c25fa3203a4eabb308 /src/lingot-config.c
parentc77651dcdf11427071d69821d63b8de80874b7a2 (diff)
- reset locale when saving the config
git-svn-id: https://lampka.siedziba.pl:790/svn/repos/lingot-win32@310 455248ca-bdda-0310-9134-f4ebb693071a
Diffstat (limited to 'src/lingot-config.c')
-rw-r--r--src/lingot-config.c12
1 files changed, 12 insertions, 0 deletions
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);
+ }
}
//----------------------------------------------------------------------------