From scm-commit at wald.intevation.org Fri Oct 8 08:55:53 2010 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Fri, 8 Oct 2010 08:55:53 +0200 (CEST) Subject: [Gpa-commits] r1026 - trunk/src Message-ID: <20101008065553.7F805866059C@pyrosoma.intevation.org> Author: werner Date: 2010-10-08 08:55:52 +0200 (Fri, 08 Oct 2010) New Revision: 1026 Modified: trunk/src/ChangeLog trunk/src/clipboard.c Log: utf-8 fix (untested) Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2010-05-06 11:15:16 UTC (rev 1025) +++ trunk/src/ChangeLog 2010-10-08 06:55:52 UTC (rev 1026) @@ -1,3 +1,7 @@ +2010-10-06 Werner Koch + + * clipboard.c (file_created_cb): Fallback to Latin-1. + 2010-05-06 Werner Koch * gpadatebutton.c: Include i18n.h. Modified: trunk/src/clipboard.c =================================================================== --- trunk/src/clipboard.c 2010-05-06 11:15:16 UTC (rev 1025) +++ trunk/src/clipboard.c 2010-10-08 06:55:52 UTC (rev 1026) @@ -270,12 +270,31 @@ if (! suc) { gchar *str; + gsize *len; + str = g_strdup_printf ("Error in operation result:\n" - "No valid UTF-8 at position %i.", + "No valid UTF-8 at position %i.\n" + "Assuming Latin-1 encoding instead.", ((int) (end - item->direct_out))); gpa_window_error (str, GTK_WIDGET (clipboard)); g_free (str); - return; + + str = g_convert (item->direct_out, item->direct_out_len, + "UTF-8", "ISO-8859-1", + NULL, &len, NULL); + if (str) + { +#ifdef G_OS_WIN32 + dos_to_unix (str, &item->direct_out_len); +#endif + + gtk_text_buffer_set_text (clipboard->text_buffer, str, len); + g_free (str); + return; + } + gpa_window_error ("Error converting Latin-1 to UTF-8", + GTK_WIDGET (clipboard)); + /* Enough warnings: Try to show even with invalid encoding. */ } #ifdef G_OS_WIN32 From scm-commit at wald.intevation.org Fri Oct 8 15:56:50 2010 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Fri, 8 Oct 2010 15:56:50 +0200 (CEST) Subject: [Gpa-commits] r1027 - trunk/src Message-ID: <20101008135650.E3C418522B9A@pyrosoma.intevation.org> Author: werner Date: 2010-10-08 15:56:50 +0200 (Fri, 08 Oct 2010) New Revision: 1027 Modified: trunk/src/ChangeLog trunk/src/clipboard.c Log: Message rephrased Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2010-10-08 06:55:52 UTC (rev 1026) +++ trunk/src/ChangeLog 2010-10-08 13:56:50 UTC (rev 1027) @@ -1,3 +1,7 @@ +2010-10-08 Werner Koch + + * clipboard.c (file_created_cb): Use gpa_window_message. + 2010-10-06 Werner Koch * clipboard.c (file_created_cb): Fallback to Latin-1. Modified: trunk/src/clipboard.c =================================================================== --- trunk/src/clipboard.c 2010-10-08 06:55:52 UTC (rev 1026) +++ trunk/src/clipboard.c 2010-10-08 13:56:50 UTC (rev 1027) @@ -272,11 +272,10 @@ gchar *str; gsize *len; - str = g_strdup_printf ("Error in operation result:\n" - "No valid UTF-8 at position %i.\n" + str = g_strdup_printf ("No valid UTF-8 encoding at position %i.\n" "Assuming Latin-1 encoding instead.", ((int) (end - item->direct_out))); - gpa_window_error (str, GTK_WIDGET (clipboard)); + gpa_window_message (str, GTK_WIDGET (clipboard)); g_free (str); str = g_convert (item->direct_out, item->direct_out_len,