How to display file names

Christian Mueller cmueller at gmx.de
Mon Dec 15 05:47:21 GMT 2003


Am Sonntag, 14. Dezember 2003 18:22 schrieb Thiago Macieira:
> Christian Mueller wrote:
> >I never noticed before, but it's exactly how André described it.
> >A file created on the command line with
> >touch 'bla %2F foo'
> >shows up like that in the different places.
> >IMHO 1) is the only correct way.  After all this *is* the file name.
> >I'd call 2) and 3) bugs.  Or am I missing something?
>
> #1 is the correct form since it's the proper filename, while #2 would be
> the URL-encoded form (as showing in Konqueror's Location field): % is a
> special character in URLs and must therefore be encoded (just like # and
> ?). In other contexts, the spaces would be replaced by %20 as well, so it
> would read:
>
> 	bla%20%252F%20foo

The "file already exists" dialog that comes up when you copy files 
contains two versions of the file name (text translated to English): 
The introductory text: 
"This action would overwrite /home/cmueller/bla %252f foo with itself." 
And then the edit field contains: 
bla / foo1

Some observations:
- The spaces are not encoded, but the the percent sign is
- The first version is not a URL but a file name.  Nevertheless the 
  percent sign is encoded
- The file name in the edit field is not displayed as-is but %2F is 
  shown as slash
- Slashes entered in the file name are automatically encoded into %2f
  when accessing a file on disk.



> Also note that '/' is an invalid character for a path component. It can
> only be used as a path separator.

Exactly, but instead of throwing an error any slashes in filenames are 
automatically encoded as %2f when accessing a file, and vice-versa 
automatically decoded when displaying the file name.
In addition, when I create a file using KDE that contains the string %2f
KDE writes %%2f instead.  In fact any percent sign is preplaced by two 
percent signs. 

So I gained the ability to use slashes in a file name on the KDE level, 
but I lost the constistency between GUI and command line. 
That seems strange to me... is this a general policy? 

Anyway, the output "/home/cmueller/bla %252f foo" in the 
"file already exists" dialog seems wrong to me.

Christian.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031215/6c1224e2/attachment.sig>


More information about the kde-core-devel mailing list