Bug 233159 - rekonq addressbar (url bar) has encoding problems (e.g. non-latin letters)
Summary: rekonq addressbar (url bar) has encoding problems (e.g. non-latin letters)
Status: RESOLVED FIXED
Alias: None
Product: rekonq
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: 0.4.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Andrea Diamantini
URL:
Keywords:
: 229694 233325 233591 235007 235336 237888 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-03 12:44 UTC by Viesturs Zarins
Modified: 2010-05-17 00:02 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Viesturs Zarins 2010-04-03 12:44:32 UTC
Version:           0.4.58 (using 4.4.2 %28KDE 4.4.2%29%2C Arch Linux)
Compiler:          gcc
OS:                Linux %28i686%29 release 2.6.32-ARCH

Steps to reproduce:
- text in addresbar that contains non latin chars, for example "ŗūķēļī"
- select the option "Search google for..."
- hit enter
- google page opens with the following text in search field "%C5%97%C5%AB%C4%B7%C4%93%C4%BC%C4%AB"

Expected behavior:
- the original text "ŗūķēļī" is used in the google search.
Comment 1 Panagiotis Papadopoulos 2010-04-03 18:30:59 UTC
*** Bug 229694 has been marked as a duplicate of this bug. ***
Comment 2 Panagiotis Papadopoulos 2010-04-06 13:58:15 UTC
*** Bug 233325 has been marked as a duplicate of this bug. ***
Comment 3 Panagiotis Papadopoulos 2010-04-06 14:26:04 UTC
I can confirm this behaviour with rekonq 0.4.58
Comment 4 Pablo 2010-04-06 17:45:21 UTC
This also happens with "spanish characters" like á, é, í, ó and ú. I use Archlinux and Rekonq 4.0
Comment 5 Jurian Sluiman 2010-04-08 16:19:08 UTC
*** Bug 233591 has been marked as a duplicate of this bug. ***
Comment 6 Andrea Diamantini 2010-04-13 03:11:03 UTC
commit eb52521b43669aab1c38ab9872a53386b776662d
Author: Andrea Diamantini <adjam7@gmail.com>
Date:   Tue Apr 13 03:01:42 2010 +0200

    This commit is (quite) last in the urlbar encodings fix series. It fixes:
    BUG: 233159
    BUG: 234168
    Moreover it "cleans" road to fix (not yet, but we are near..) another bug
    CCBUG: 230771
    at least from the rekonq side.
    
    Changes in there
    - cleaning and fixing filterurljob class (responsible for the encodings)
    - using urls instead of strings in the resolver class (work with right data..)
    - letting first box appearance without item selection and adding one signal to use
    the filterurljob class directly.

diff --git a/src/filterurljob.cpp b/src/filterurljob.cpp
index e74f8ec..f94b781 100644
--- a/src/filterurljob.cpp
+++ b/src/filterurljob.cpp
@@ -58,7 +58,12 @@ void FilterUrlJob::run()
     // the beautiful KDE web browsing shortcuts
     KUriFilterData data(_urlString);
     data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
-    _url = KUriFilter::self()->filterUri(data) 
-        ? data.uri().pathOrUrl() 
-        : QUrl::fromUserInput( _urlString );
+
+    if(KUriFilter::self()->filterUri(data) && data.uriType() != KUriFilterData::Error)
+    {
+        QString tempUrlString = data.uri().url();
+        _url = KUrl(tempUrlString);
+    }
+    else
+        _url = QUrl::fromUserInput( _urlString );
 }
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 740f147..0733b1f 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -97,7 +97,6 @@ void CompletionWidget::sizeAndPosition()
 
 void CompletionWidget::popup()
 {
-    down();
     sizeAndPosition();
     if (!isVisible()) 
         show();
@@ -210,7 +209,10 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
                 case Qt::Key_Enter:
                 case Qt::Key_Return:
                         hide();
-                        emit chosenUrl(_list.at(_currentIndex).url, Rekonq::CurrentTab);
+                        if(_currentIndex >= 0)
+                            emit chosenUrl(_list.at(_currentIndex).url, Rekonq::CurrentTab);
+                        else
+                            emit loadTypedUrl();
                         ev->accept();
                         return true;
                     break;
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index ab78e48..57a8bed 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -59,7 +59,8 @@ private slots:
 
 signals:
     void chosenUrl(const KUrl &, Rekonq::OpenType);
-
+    void loadTypedUrl();
+    
 private:
     void sizeAndPosition();
     void up();
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 3b79b06..5423e5d 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -74,6 +74,7 @@ UrlBar::UrlBar(QWidget *parent)
     // suggestions
     installEventFilter(_box);
     connect(_box, SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), SLOT(activated(const KUrl &, Rekonq::OpenType)));
+    connect(_box, SIGNAL(loadTypedUrl()), this, SLOT(activated()));
 }
 
 
@@ -108,8 +109,16 @@ void UrlBar::activated(const KUrl& url, Rekonq::OpenType type)
     disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
     
     clearFocus();
-    setUrl(url);
-    Application::instance()->loadUrl(url, type);
+    KUrl loadingUrl;
+    
+    if(url.isEmpty())
+        loadingUrl = KUrl(text());
+    else
+        loadingUrl = url;
+    
+    setUrl(loadingUrl);
+    
+    Application::instance()->loadUrl(loadingUrl, type);
 }
 
 
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index a473638..684a205 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -60,7 +60,7 @@ public:
     void setPrivateMode(bool on);
 
 private slots:
-    void activated(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab);
+    void activated(const KUrl& url = KUrl(), Rekonq::OpenType = Rekonq::CurrentTab);
     void suggestUrls(const QString &editedText);
     void setQUrl(const QUrl &url);
Comment 7 Panagiotis Papadopoulos 2010-04-23 18:09:17 UTC
*** Bug 235007 has been marked as a duplicate of this bug. ***
Comment 8 Panagiotis Papadopoulos 2010-04-25 21:51:52 UTC
*** Bug 235336 has been marked as a duplicate of this bug. ***
Comment 9 Oleg Atamanenko 2010-05-11 08:23:02 UTC
I have the same issue with cyrillic letters.
Comment 10 Panagiotis Papadopoulos 2010-05-17 00:02:46 UTC
*** Bug 237888 has been marked as a duplicate of this bug. ***