[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: KURIFilter: Google shortcut fails with umlauts
From: Malte Starostik <malte () kde ! org>
Date: 2003-09-18 23:11:34
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I can't tell when it first happened, I only noticed this today. My default
charset is latin1 while the google web shortcut uses utf-8.
When typing "gg:ümläüts" into minicli or konq's location bar, this results in
an incorrect query string: the query contains "ümläüts" in URL-encoded
latin1, but the encoding parameter included in the query string says it's
utf-8.
When entering the above shortcut into the location bar/minicli, it's converted
to a KURL using my locale's default encoding (latin1), but the web shortcut
plugin decodes this URL using the charset specified in the
shortcut's .desktop file (utf-8).
Of course I could change the charset to latin1, but that would mean I'd also
have to change the URL passed to google to indicate this and cannot any
longer use the default google.desktop file.
IMHO the direct problem here is that the web shortcut filter uses the same
codec when decoding the user input string as well as when encoding the
filtered URL.
The attached patches fix the above problem for me. It's not complete though,
e.g. the shorturi filter uses KURL::decode_string() with no encoding hint, so
I guess it might fail there; the auto web filter doesn't seem to handle
encodings at all from a short look.
Did I miss anything else? Any other suggestions?
BTW: is there something simpler (faster?) than
QTextCodec::codecForName( "utf8" )->mibEnum()? Is it safe to hard-code 106?
Regards,
- -Malte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/ajupVDF3RdLzx4cRAp4fAKCbBP0LhB4Of70RpM0yAa/UZt1lxACgs3cm
lqLCJVCsmB/+oNr51WY2J/M=
=EtI6
-----END PGP SIGNATURE-----
["kdebase-kcontrol-ebrowsing-plugins-ikws.diff" (text/x-diff)]
Index: kuriikwsfiltereng.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/ebrowsing/plugins/ikws/kuriikwsfiltereng.cpp,v
retrieving revision 1.36
diff -u -3 -d -p -r1.36 kuriikwsfiltereng.cpp
--- kuriikwsfiltereng.cpp 31 Aug 2003 15:18:03 -0000 1.36
+++ kuriikwsfiltereng.cpp 18 Sep 2003 23:08:27 -0000
@@ -406,7 +406,7 @@ QString KURISearchFilterEngine::formatRe
}
// Decode user query:
- QString userquery = KURL::decode_string(query, csetacodec->mibEnum());
+ QString userquery = KURL::decode_string(query, QTextCodec::codecForName("utf8")->mibEnum());
PDVAR ("user query", userquery);
PDVAR ("query definition", url);
["kdelibs-kio-kio.diff" (text/x-diff)]
Index: kurifilter.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kurifilter.cpp,v
retrieving revision 1.39
diff -u -3 -d -p -r1.39 kurifilter.cpp
--- kurifilter.cpp 31 Aug 2003 09:30:34 -0000 1.39
+++ kurifilter.cpp 18 Sep 2003 23:08:07 -0000
@@ -26,6 +26,7 @@
#include <klibloader.h>
#include <kstaticdeleter.h>
#include <kparts/componentfactory.h>
+#include <qtextcodec.h>
#include "kurifilter.h"
@@ -89,7 +90,7 @@ void KURIFilterData::init( const KURL& u
void KURIFilterData::init( const QString& url )
{
m_iType = KURIFilterData::UNKNOWN;
- m_pURI = url;
+ m_pURI = KURL( url, QTextCodec::codecForName( "utf8" )->mibEnum() );
m_strErrMsg = QString::null;
m_strIconName = QString::null;
m_bCheckForExecutables = true;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic