[Kmymoney-devel] OFX and UTF-8 problem

Thomas Baumgart thb at net-bembel.de
Mon Jan 23 13:24:39 UTC 2012


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.glNyNyvm3L
> %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();

  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);       <------

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);



Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20120123/a53da56d/attachment.sig>

More information about the KMyMoney-devel mailing list