From kde-pim Fri Mar 14 08:35:12 2008 From: =?UTF-8?B?SmFyb3PFgmF3IFN0YW5pZWs=?= Date: Fri, 14 Mar 2008 08:35:12 +0000 To: kde-pim Subject: [Kde-pim] [patch] KMail: fox for text codecs + questions on Message-Id: <47DA38C0.40607 () iidea ! pl> X-MARC-Message: https://marc.info/?l=kde-pim&m=120548730928587 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------020704000801000100040103" This is a multi-part message in MIME format. --------------020704000801000100040103 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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) --------------020704000801000100040103 Content-Type: text/plain; name="codec_win_and_japanese.patch" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="codec_win_and_japanese.patch" SW5kZXg6IGttYWlsL2tta2VybmVsLmNwcA0KPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGttYWlsL2tt a2VybmVsLmNwcAkocmV2aXNpb24gNzg1NTA0KQ0KKysrIGttYWlsL2tta2VybmVsLmNwcAko d29ya2luZyBjb3B5KQ0KQEAgLTEzOSwxNyArMTM5LDI1IEBADQogCiAgIG5ldyBLcGdwOjpN b2R1bGUoKTsKIAorICBuZXRDb2RlYyA9IFFUZXh0Q29kZWM6OmNvZGVjRm9yTmFtZSggS0ds b2JhbDo6bG9jYWxlKCktPmVuY29kaW5nKCkgKTsKKwogICAvLyBJbiB0aGUgY2FzZSBvZiBK YXBhbi4gSmFwYW5lc2UgbG9jYWxlIG5hbWUgaXMgImV1Y2pwIiBidXQKICAgLy8gVGhlIEph cGFuZXNlIG1haWwgc3lzdGVtcyBub3JtYWxseSB1c2VkICJpc28tMjAyMi1qcCIgb2YgbG9j YWxlIG5hbWUuCiAgIC8vIFdlIHdhbnQgdG8gY2hhbmdlIGxvY2FsZSBuYW1lIGZyb20gZXVj anAgdG8gaXNvLTIwMjItanAgYXQgS01haWwgb25seS4KLSAgaWYgKCBRQnl0ZUFycmF5KFFU ZXh0Q29kZWM6OmNvZGVjRm9yTG9jYWxlKCktPm5hbWUoKSkudG9Mb3dlcigpID09ICJldWNq cCIgKQorCisgIC8vIChJbnRyb2R1Y3Rpb24gdG8gaTE4biwgNi42IExpbWl0IG9mIExvY2Fs ZSB0ZWNobm9sb2d5KToKKyAgLy8gRVVDLUpQIGlzIHRoZSBkZS1mYWN0byBzdGFuZGFyZCBm b3IgVU5JWCBzeXN0ZW1zLCBJU08gMjAyMi1KUAorICAvLyBpcyB0aGUgc3RhbmRhcmQgZm9y IEludGVybmV0LCBhbmQgU2hpZnQtSklTIGlzIHRoZSBlbmNvZGluZyAKKyAgLy8gZm9yIFdp bmRvd3MgYW5kIE1hY2ludG9zaC4KKyAgaWYgKCBuZXRDb2RlYy0+bmFtZSgpLnRvTG93ZXIo KSA9PSAiZXVjanAiIAorI2lmIGRlZmluZWQgUV9XU19XSU4gfHwgZGVmaW5lZCBRX1dTX01B Q1gKKyAgICB8fCBuZXRDb2RlYy0+bmFtZSgpLnRvTG93ZXIoKSA9PSAic2hpZnQtamlzIiAp IC8vIE9LPworI2VuZGlmCiAgIHsKICAgICBuZXRDb2RlYyA9IFFUZXh0Q29kZWM6OmNvZGVj Rm9yTmFtZSgiamlzNyIpOwogICAgIC8vIFFUZXh0Q29kZWMgKmNkYyA9IFFUZXh0Q29kZWM6 OmNvZGVjRm9yTmFtZSgiamlzNyIpOwogICAgIC8vIFFUZXh0Q29kZWM6OnNldENvZGVjRm9y TG9jYWxlKGNkYyk7CiAgICAgLy8gS0dsb2JhbDo6bG9jYWxlKCktPnNldEVuY29kaW5nKGNk Yy0+bWliRW51bSgpKTsKLSAgfSBlbHNlIHsKLSAgICBuZXRDb2RlYyA9IFFUZXh0Q29kZWM6 OmNvZGVjRm9yTG9jYWxlKCk7CiAgIH0KIAogICBjb25uZWN0KCBNYWlsVHJhbnNwb3J0OjpU cmFuc3BvcnRNYW5hZ2VyOjpzZWxmKCksCg== --------------020704000801000100040103 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KDE PIM mailing list kde-pim@kde.org https://mail.kde.org/mailman/listinfo/kde-pim KDE PIM home page at http://pim.kde.org/ --------------020704000801000100040103--