KUrl api docs wrong, or bug in the code?

Thiago Macieira thiago at kde.org
Wed Aug 20 13:04:58 BST 2008


On Wednesday 20 August 2008 13:55:07 Andreas Pakulat wrote:
> On 18.08.08 18:50:18, Michael Pyne wrote:
> > On Monday 18 August 2008, Andreas Pakulat wrote:
> > > Hi,
> > >
> > > the api docs of KUrl say that one can feed the result of
> > > KUrl::pathOrUrl() back into the KUrl constructor. But as far as I can
> > > see this is not true. The constructor expects a remote url to be in
> > > percent-encoding, i.e. no non-ascii characters in path or fragment.
> > > While pathOrUrl uses prettyUrl which in turn produces unicode
> > > characters instead of percent-encoding in path and fragment.
> > >
> > > I'm wondering now wether the api dox need to be changed to tell users
> > > to use QUrl::setUrl() when reconstructing a url from the result of
> > > pathOrUrl() or wether the code needs to be changed.
> >
> > I would say that the docs are pretty clear.  Do we have a testcase on
> > this particular topic (feeding pathOrUrl() back to KUrl's ctor?)
>
> We didn't have tests doing that, but I just added them. And it turns out
> that I must have misread the  code or not read enough. At least the
> tests I added succeed, which means the encoded version of a url created
> from pathOrUrl is the same as the encoded version of the original url.

Test paths containing any of the following chars:
	%
	#
	?

For %, try both something that produces an hex-encoded data (like %40) and 
something that doesn't (%s).

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080820/109cb7b2/attachment.sig>


More information about the kde-core-devel mailing list