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



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14676 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2006-08-15 13:39:19 +00:00
parent 59a95cce9b
commit 9f9dcbb5b9
2 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2006-08-15 Christian Stimming <stimming@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@employees.org>
* src/core-utils/gnc-gconf-utils.[ch]:

View File

@ -867,13 +867,26 @@ void blz_changed_cb(GtkEditable *e, gpointer user_data)
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 ?