[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KIO::UDSEntry and URL encoding
From: Martin Koller <kollix () aon ! at>
Date: 2012-08-15 19:01:57
Message-ID: 201208152102.02933.kollix () aon ! at
[Download RAW message or body]
On Monday, 13. August 2012 16:03:48 Thiago Macieira wrote:
> On segunda-feira, 13 de agosto de 2012 14.28.02, Martin Koller wrote:
> > Hi,
> > (using 4.9.0)
> >
> > when using konqueror and typing "man:" it starts to list possible entries
> > which the kio_man slave generates. However, konqueror displays percent
> > encoded URLs, e.g. "man:%281%29/" instead of "man:(1)/" kio_man creates the
> > KIO::UDSEntry as follows:
> >
> > QString name = "man:/(" + *it + ')';
> > uds_entry.insert( KIO::UDSEntry::UDS_NAME, sectionName( *it ) );
> > uds_entry.insert( KIO::UDSEntry::UDS_URL, name );
> >
> > (sectionName(...) delivers a human readable text)
> >
> > What I do not find in the KIO::UDSEntry documentation is if the URL should
> > use percent encoded strings or not. However doing a simple test where I
> > explicitely use QString name = "man:/%28" + *it + "%29"; does not work
> > either.
>
> That's not a decision of UDSEntry. That's a decision of who's displaying the
> URL.
>
> The two URLs are equivalent, so there's nothing wrong with the encoding. It's
> just a matter of whether konqueror decides to decode the parentheses.
>
> > Is this a general problem in konqueror (or the combobox it uses or I don't
> > know where in kdelibs) or do I have to change something in kio_man ?
>
> It's not a problem. The behaviour you're describing is "general" though.
Well, it's a problem for the user.
I found out that the culprit is KUrlCompletion, which - for whatever reason -
uses QUrl::toPercentEncoding() when an URL is to be shown.
I also found out that Qt seems to have a "bug" (in quotes because as you said percent \
encoding is equivalent to unecoded chars): QUrl::toPercentEncoding() defines \
unreserved chars as: Unreserved is defined as: ALPHA / DIGIT / "-" / "." / "_" / "~"
but rfc2396 defines this set as:
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
I'd like to fix the problem in KUrlCompletion and tried to simply add an additional
exclude array of "()!*'", which at least makes man:(1)/ etc. URLs human readable.
However, I see that there is still some inconsistency in what konqueror shows in its
completion list. E.g. when typing "man:mklos" it shows "man:mklost%2Bfound" in the \
completion list, but when I select this entry, the URL in the address line edit is \
changed and displays as "man:mklost+found"
Even worse: when I now again type "man:mklos", I get 2 entries in the completion list
"man:mklost%2Bfound" and "man:mklost+found" (the one coming from the completion, the \
other from the history) No matter which one I chose, the result in the address line \
edit is always the unencoded one, which
- for a user - makes much more sense.
So my main question is: would it hurt anyone to simply completely get rid of \
QUrl::toPercentEncoding() in the KUrlCompletion implementation ?
Why would I ever want to get a percent encoded string from a completer, which is \
about helping a human ?
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic