From b546bed0f6a69f82c4286583256826a08f467fa6 Mon Sep 17 00:00:00 2001 From: pp Date: Sat, 22 Mar 2008 17:54:39 +0000 Subject: - reset locale when saving the config git-svn-id: https://lampka.siedziba.pl:790/svn/repos/lingot-win32@310 455248ca-bdda-0310-9134-f4ebb693071a --- src/lingot-config.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 #include #include +#include #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); + } } //---------------------------------------------------------------------------- -- cgit v1.2.3