[Kmymoney-devel] Fwd: KMyMoney: proposal to replace hard coded utf-8 in KReportsView::KReportTab

Alvaro Soliverez asoliverez at gmail.com
Wed Mar 24 20:20:55 CET 2010


Hello,
I'm forwarding this to the mailing list, which is the appropriate
place to deal with this.

Thanks a lot for the patch and the clear explanation, I'll review as
soon as possible for inclusion before next week's release.

Regards,
Alvaro


---------- Forwarded message ----------
From: Bernd Gonsior <bgo at freeplexx.de>
Date: Wed, Mar 24, 2010 at 4:02 PM
Subject: KMyMoney: proposal to replace hard coded utf-8 in
KReportsView::KReportTab
To: asoliverez at gmail.com


Dear Mr. Soliverez,

thank you for developing KMyMoney. It is really great and i do use it for my
daily work.

Unfortunately i am a german who intentionally uses latin1 instead of utf-8
which always made some trouble when creating reports with KMyMoney because
german umlauts did not appear correct.

The reason is that 'utf-8' is 2 times hardcoded in KReportsView::KReportTab.
One can find it in svn revision r1106729 here:

1. KReportsView::KReportTab::saveAs, line 147:

 QRegExp exp("(.*)(<link.*css\" href=)\"(.*)\">(<meta.*utf-8\" />)(.*)");

(this regexp was used to split the just generated html so that css could be
included inline, but if the encoding was not 'utf-8' but instead e.g. 'latin1'
this regexp took ages)

2. KReportsView::KReportTab::createTable, line 234:

 header += "<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=utf-8\" />";


Proposal:

KGlobal::locale()->encoding() should be used instead of hard coded 'utf-8'.

Furthermore the above mentioned regexp for including css inline could be
replaced by more clearly declared methods.

I appended the svn-diffs and the new files to this mail. If you find it
useful, maybe you can include it in any way you like. The main things are
outlined in kreportsview.h.

With best regards

Dipl.-Ing. Bernd Gonsior
Dolgenseestrasse 43
10319 berlin
Germany

phone: +49-30-20 23 89 98
email: bgo at freeplexx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kreportsview.cpp
Type: text/x-c++src
Size: 52368 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100324/a5569a37/attachment-0001.cpp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kreportsview.h.dif
Type: text/x-patch
Size: 2343 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100324/a5569a37/attachment-0002.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kreportsview.h
Type: text/x-chdr
Size: 9021 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100324/a5569a37/attachment-0001.h 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kreportsview.cpp.dif
Type: text/x-patch
Size: 4256 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100324/a5569a37/attachment-0003.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100324/a5569a37/attachment-0001.sig 


More information about the KMyMoney-devel mailing list