2006-04-12 [wwp] 2.1.0cvs32
authorTristan Chabredier <wwp@claws-mail.org>
Wed, 12 Apr 2006 07:17:36 +0000 (07:17 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Wed, 12 Apr 2006 07:17:36 +0000 (07:17 +0000)
* src/prefs_gtk.c
fix for bug #935: always store prefs files in UTF-8 (thanks
to Colin).

ChangeLog
PATCHSETS
configure.ac
src/prefs_gtk.c

index bd5d68299e2815ef9a6dc4506ca25ce73ac1f928..84c14251411ee5a060976a9772a87da8b1190d90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-04-12 [wwp]       2.1.0cvs32
+
+       * src/prefs_gtk.c
+               fix for bug #935: always store prefs files in UTF-8 (thanks
+               to Colin).
+
 2006-04-11 [colin]     2.1.0cvs31
 
        * src/compose.c
index 8576dea650a5dba5186f40ea7a347baf73199542..f1a2a5afb954480093704609d67f0123d4d7afa3 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.261 -r 1.382.2.262 src/compose.c;  cvs diff -u -r 1.204.2.83 -r 1.204.2.84 src/prefs_common.c;  ) > 2.1.0cvs29.patchset
 ( cvs diff -u -r 1.149.2.46 -r 1.149.2.47 src/inc.c;  ) > 2.1.0cvs30.patchset
 ( cvs diff -u -r 1.382.2.262 -r 1.382.2.263 src/compose.c;  ) > 2.1.0cvs31.patchset
+( cvs diff -u -r 1.10.2.18 -r 1.10.2.19 src/prefs_gtk.c;  ) > 2.1.0cvs32.patchset
index c96c05a4337f95e040be96dd4f2c12850cd62fd6..abdaae22f85f7ed076be895179e0326371d28df2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 24fa2cfa7378469e2a43cc2bdcd8c2e2f95b44fc..718353d9d2e2820012ac0afce7b0a0abd2fa0f90 100644 (file)
@@ -62,6 +62,9 @@ void prefs_read_config(PrefParam *param, const gchar *label,
        g_return_if_fail(label != NULL);
        g_return_if_fail(rcfile != NULL);
 
+       if (encoding != NULL)
+               g_warning("Encoding is ignored\n");
+
        debug_print("Reading configuration...\n");
 
        prefs_set_default(param);
@@ -138,13 +141,19 @@ void prefs_config_parse_one_line(PrefParam *param, const gchar *buf)
                switch (param[i].type) {
                case P_STRING:
                {
-                       gchar *tmp;
+                       gchar *tmp = NULL;
 
-                       tmp = *value ?
-                               conv_codeset_strdup(value,
-                                                   conv_get_locale_charset_str(),
-                                                   CS_UTF_8)
-                               : g_strdup("");
+                       if (*value) {
+                               if (g_utf8_validate(value, -1, NULL))
+                                       tmp = g_strdup(value);
+                               else {
+                                       tmp = conv_codeset_strdup(value,
+                                                   conv_get_locale_charset_str_no_utf8(),
+                                                   CS_INTERNAL);
+                               }
+                       } else {
+                               tmp = g_strdup("");
+                       }
                        if (!tmp) {
                                g_warning("failed to convert character set.");
                                tmp = g_strdup(value);
@@ -293,11 +302,15 @@ gint prefs_write_param(PrefParam *param, FILE *fp)
                        gchar *tmp = NULL;
 
                        if (*((gchar **)param[i].data)) {
-                               tmp = conv_codeset_strdup(*((gchar **)param[i].data),
-                                                         CS_UTF_8,
-                                                         conv_get_locale_charset_str());
-                               if (!tmp)
+                               if (g_utf8_validate(*((gchar **)param[i].data), -1, NULL))
                                        tmp = g_strdup(*((gchar **)param[i].data));
+                               else {
+                                       tmp = conv_codeset_strdup(*((gchar **)param[i].data),
+                                               conv_get_locale_charset_str_no_utf8(),
+                                               CS_INTERNAL);
+                                       if (!tmp)
+                                               tmp = g_strdup(*((gchar **)param[i].data));
+                               }
                        }
 
                        g_snprintf(buf, sizeof(buf), "%s=%s\n", param[i].name,
@@ -386,7 +399,7 @@ void prefs_set_default(PrefParam *param)
                                        tmp = envstr && *envstr ?
                                                conv_codeset_strdup(envstr,
                                                                    conv_get_locale_charset_str(),
-                                                                   CS_UTF_8)
+                                                                   CS_INTERNAL)
                                                : g_strdup("");
                                        if (!tmp) {
                                                g_warning("faild to convert character set.");