r14363 - gnucash/trunk - Similarly ensure for aqbanking/mt940 import that all retrieved strings

Christian Stimming stimming at tuhh.de
Wed Jun 14 16:37:04 EDT 2006


Am Mittwoch, 14. Juni 2006 22:04 schrieb David Hampton:
> > Modified:
> >    gnucash/trunk/ChangeLog
> >    gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.c
> > Log:
> > Similarly ensure for aqbanking/mt940 import that all retrieved strings
> > will be valid utf8.
>
> I noticed that the hbci protocol specifies utf-8 and then the data is
> converted to the local code set.  I was going to commit the following
> change so that hbci data remained as utf8.

Actually my message about "mt940" is a bit misleading. What my change does is 
to ensure utf8 on all data from aqbanking. (mt940, which uses aqbanking 
internally, is just another case where this might be needed.)

As you say, the aqbanking library claims that it will return the text data in 
utf8. However this is only completely sure when aqbanking is used for the 
HBCI protocol.  As Martin confirmed to me, this assumption currently might 
fail if aqbanking is used to import data from some file, either from mt940 or 
(potentially) something else. And actually this assumption might fail if 
aqbanking is used for ofx-directconnect and the bank server stupidly sends 
some wrongly encoded data.

So currently for HBCI the gnc_utf8_strip_invalid()  function does nothing. But 
since this very same program code is being used for ofx-directconnect and for 
mt940 file import, I figured I rather add these extra precautions here to 
avoid any potential dangerous encoding problems.

Your other change can be applied right away.

Christian

>
>
> Index: src/import-export/hbci/gnc-hbci-utils.c
> ===================================================================
> ---src/import-export/hbci/gnc-hbci-utils.c	(revision 14353)
> +++ src/import-export/hbci/gnc-hbci-utils.c	(working copy)
> @@ -628,12 +628,7 @@
>
>  const char *gnc_hbci_book_encoding()
>  {
> -#if HAVE_LANGINFO_CODESET
> -  char* encoding = nl_langinfo(CODESET);
> -#else
> -  char* encoding = "UTF-8";
> -#endif
> -  return encoding;
> +  return "UTF-8";
>  }
>
>
> Would this change have fixed my940 as well, or is it hbci specific?
>
> David
>
>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel


More information about the gnucash-devel mailing list