[PATCH] BUG 158663 - Encoding detection is broken in Konqueror

Thanomsub Noppaburana donga.nb at gmail.com
Mon Oct 13 06:28:24 BST 2008


Hi,

I'm Thai and have a problem about encoding detection which report as
bug 158663 on kdelibs-4.1.2 too.

After trying to solve in the other points,
I found the problem was came from kdecore/localization/kencodingdetector.cpp
in KEncodingDetector::analyze(const char *data, int len) method,
block: if (!d->m_seenBody) { ...
which position of finding '=' is still point to '=' position.
So, when it pass to setEncoding, the result always 'false'
because the "charset" ByteArray was always leading with '='.

The debug result is something like this:
KEncodingDetector: found charset in <meta>: =windows-874

After added "++pos;" line, now, my Konqueror can detect encoding correctly.

>>--- kdelibs-4.1.2.orig/kdecore/localization/kencodingdetector.cpp	2008-08-28 15:08:22.000000000 +0700
>>+++ kdelibs-4.1.2/kdecore/localization/kencodingdetector.cpp	2008-10-11 02:58:22.000000000 +0700
>>@@ -1023,6 +1023,9 @@
>>                 if( (pos = str.indexOf("=", pos)) == -1)
>>                     continue;
>>
>>+                // skip '='
>>+                ++pos;
>>+
>>                 // skip whitespace before encoding itself
>>                 while (pos < (int)str.length() && str[pos] <= ' ')
>>                     ++pos;

patch attached to bugs.kde.org: https://bugs.kde.org/attachment.cgi?id=27803

Regards,
donga.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-4.1.2-encodingdetect.patch
Type: text/x-patch
Size: 651 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081013/d08ca3b1/attachment.bin>
-------------- next part --------------
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


More information about the kde-core-devel mailing list