[Kmymoney-devel] OFX and UTF-8 problem

Benoit Grégoire benoitg at coeus.ca
Wed Feb 1 17:34:49 UTC 2012


On January 23, 2012 02:24:39 PM Thomas Baumgart wrote:
> Hi,
> 
> on Monday 23 January 2012 13:52:47 Martin Javorek wrote:
> > > It could be that libofx (ofxdump is part of the project) has a
> > > problem. KMyMoney uses libofx to import OFX data. I think you should
> > > post the above question to the project's developers [1]. My
> > > observation that with the text header it works and without it does not
> > > was empirical :).
> > 
> > I want know more. So I have asked in ofxlib forum.
> > http://sourceforge.net/mailarchive/forum.php?thread_name=1738901.glNyNyvm3
> > L
> > %40benoitg-t510&forum_name=libofx-devel But it looks, there is maybe
> > something between KMyMoney ofxlib usage and ofxlib implementation.
> 
> Benoit asks, if we in KMyMoney do any preprocessing on the file's contents.
> That's an easy answer: no, because we only pass the filename to libofx.
> 
>   LibofxContextPtr ctx = libofx_get_new_context();
>   Q_CHECK_PTR(ctx);
> 
>   qDebug("setup callback routines");
>   ofx_set_transaction_cb(ctx, ofxTransactionCallback, this);
>   ofx_set_statement_cb(ctx, ofxStatementCallback, this);
>   ofx_set_account_cb(ctx, ofxAccountCallback, this);
>   ofx_set_security_cb(ctx, ofxSecurityCallback, this);
>   ofx_set_status_cb(ctx, ofxStatusCallback, this);
>   qDebug("process data");
>   libofx_proc_file(ctx, filename_deep, AUTODETECT);       <------
>   libofx_free_context(ctx);
> 
> Inside the callbacks, we expect data to be UTF-8 formatted. E.g. for the
> transaction callback:
> 
>   if (data.check_number_valid == true) {
>     t.m_strNumber = QString::fromUtf8(data.check_number);
>   }

Well, this should work.  Can you send me a sample of a problematic file?

In any event, OFX2 files should NOT have text headers...
-- 
Benoit Grégoire, ing., PMP, PSM


More information about the KMyMoney-devel mailing list