AUDIT: r14676 - gnucash/trunk - Ensure the encoding of the ktoblzcheck library is used correctly.

Christian Stimming cstim at cvs.gnucash.org
Tue Aug 15 09:39:21 EDT 2006


Author: cstim
Date: 2006-08-15 09:39:19 -0400 (Tue, 15 Aug 2006)
New Revision: 14676
Trac: http://svn.gnucash.org/trac/changeset/14676

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
Log:
Ensure the encoding of the ktoblzcheck library is used correctly. 
Their encoding is still always ISO-8859-1, but in future versions 
they might change it to something else. We're prepared now.
BP



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-08-15 05:11:07 UTC (rev 14675)
+++ gnucash/trunk/ChangeLog	2006-08-15 13:39:19 UTC (rev 14676)
@@ -1,3 +1,11 @@
+2006-08-15  Christian Stimming <stimming at tuhh.de>
+
+	* src/import-export/hbci/dialog-hbcitrans.c (blz_changed_cb):
+	Ensure the encoding of the ktoblzcheck library is used
+	correctly. Their encoding is still always ISO-8859-1, but in
+	future versions they might change it to something else. We're
+	prepared now.
+
 2006-08-15  David Hampton  <hampton at employees.org>
 
 	* src/core-utils/gnc-gconf-utils.[ch]:

Modified: gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2006-08-15 05:11:07 UTC (rev 14675)
+++ gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2006-08-15 13:39:19 UTC (rev 14676)
@@ -867,13 +867,26 @@
   if (record) {
     const char *bankname = AccountNumberCheck_Record_bankName (record);
     GError *error = NULL;
+    const char *ktoblzcheck_encoding = 
+#ifdef KTOBLZCHECK_VERSION_MAJOR
+      /* This version number macro has been added in
+	 ktoblzcheck-1.10, but this function exists already since
+	 ktoblzcheck-1.7, so we're on the safe side. */
+      AccountNumberCheck_stringEncoding()
+#else
+      /* Every ktoblzcheck release before 1.10 is guaranteed to
+	 return strings only in ISO-8859-15. */
+      "ISO-8859-15"
+#endif
+      ;
     gchar *utf8_bankname = g_convert (bankname, strlen(bankname), 
-				      "UTF-8", "ISO-8859-15",
+				      "UTF-8", ktoblzcheck_encoding,
 				      NULL, NULL, &error);
     if (error != NULL) {
-      printf ("Error convertion bankname \"%s\" to UTF-8\n", bankname);
+      printf ("Error converting bankname \"%s\" to UTF-8\n", bankname);
       g_error_free (error);
-      utf8_bankname = g_strdup (bankname);
+      /* Conversion was erroneous, so don't use the string */
+      utf8_bankname = g_strdup (_("(unknown)"));
     }
     gtk_label_set_text (GTK_LABEL (td->recp_bankname_label),
 			(strlen(utf8_bankname)>0 ? 



More information about the gnucash-changes mailing list