[patch] KMail: fox for text codecs + questions on KCharsets and QTextCodec::codecForLocale()->name() on UNIX
Jarosław Staniek
js at iidea.pl
Fri Mar 14 08:35:12 GMT 2008
For review.
1. For creating emails use codec returned by KGlobal::locale()->encoding(),
what on non-windows is equal to QTextCodec::codecForLocale() (see
KLocalePrivate::initEncoding()).
On windows QTextCodec::codecForLocale() returns "System", so we're using
GetLocaleInfo() to get the actual CP system's charset.
We'd map that to ISO soon (on any platform, I guess), preferably using a small
array coming from GNU Mailutils' locale.c [1].
CC'd to core-devel: do you think we could put the ISO-mapping functionality in
KCharsets? Useful for various converters when we want sane defaults instead of
CP charsets.
1.1. Additional question:
From the QTextCodec::codecForLocale() docs:
''On Windows, the codec will be based on a system locale. On Unix systems,
starting with Qt 4.2, the codec will be using the iconv library. Note that
in both cases the codec's name will be "System".''
So did QTextCodec::codecForLocale() work for us on UNIX before my patch, since
QTextCodec::codecForLocale()->name()=="System"?
I especially mean that this line wouldn't work as expected for >=Qt4.2:
QByteArray(QTextCodec::codecForLocale()->name()).toLower() == "eucjp"
Moreover, we have to find all the uses of QTextCodec::codecForLocale()->name()
in KDE, like the one in KNode::Settings::Settings(), and preferably fix them
in a similar way as in KMail.
2. A fix for japanese codec on Windows and Mac (just switches from shift-jis
to jis7 in addition to the previous behaviour so would not break things), see
the comment added in the code.
[1]
http://www.koders.com/c/fid63F33F4A9791A8C976B1D18A40A8A452DA0B296C.aspx?s=gnu+mailutils#L1
--
regards / pozdrawiam, Jaroslaw Staniek
Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
KDE Libraries for MS Windows (http://windows.kde.org)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: codec_win_and_japanese.patch
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080314/256d55c9/attachment.ksh>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-core-devel
mailing list