'file' URI scheme

Thiago Macieira thiago at kde.org
Mon Mar 31 04:06:50 PDT 2008

On Monday 31 March 2008 12:49:38 Alexander Larsson wrote:
> One way we in Gnome try to handle this is to avoid showing URIs to the
> user as much as possible. For instance the nautilus pathbar can show the
> right names in your above example even when the URI can't.

We try to do that in KDE as well. URLs are internally kept in parsed form and 
the canonical transport is a strict string, with all unreserved characters 
percent-encoded. Only when it is actually shown to the user is it decoded.

My point is that supporting other encodings is difficult. For example, if you 
had an FTP URL to localhost (ftp://localhost/), you would not be able to 
change to "file" without it breaking: the FTP URL would use UTF-8 to decode, 
whereas the local one wouldn't.

KDE 4.0 does not support non-UTF-8 locales. The reason is that we keep all 
filenames in Unicode form (UTF-16). Until recently, we had no API to extract 
the raw, percent-encoded path from a URL -- the only way was the UTF-16 
QUrl::path() function. Even now, this would lead to code like:

  if (url-protocol is "file") {
    percent-encoded ← url.percent-encoded-path
    byte-stream ← percent-decode(percent-encoded)
    path ← decode-according-to-locate(byte-stream)
  } else {
    path ← url.utf16-path

We have no plans of implementing that support.

  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: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/xdg/attachments/20080331/05240db5/attachment.pgp 

More information about the xdg mailing list