User:Mschiff/Slashes in Filenames: Difference between revisions

From KDE TechBase
No edit summary
 
Line 29: Line 29:


=The solution=
=The solution=
=== Marcs solution ===


I vote for just removing this feature to prevent all those problems described above and to solve the related bugreports.
I vote for just removing this feature to prevent all those problems described above and to solve the related bugreports.
=== Davids solution ===
I found a much better solution to allow '/' without all this escaping: using a unicode character that looks like a slash but that isn't '/': QChar(0x2044), also known as "FRACTION SLASH".Looks quite nice IMHO: http://web.davidfaure.fr/kde/slash.jpg
Ah... of course there's one downside: if you name a file "http://www.kde.org" you can't copy paste that name into the webbrowser as a URL, since the slashes are not real slashes anymore. Oh well, corner case of the corner case..


=Related bugreports=
=Related bugreports=
* https://bugs.kde.org/show_bug.cgi?id=51306
* https://bugs.kde.org/show_bug.cgi?id=51306
* https://bugs.kde.org/show_bug.cgi?id=100516
* https://bugs.kde.org/show_bug.cgi?id=100516

Latest revision as of 15:57, 21 January 2008

This is about KDEs special feature of allowing slashes (/) in filenames.

Date: 08/01/17

The problem

KDE allows filenames containing a slash (/). Technically it is not possible to have "/" in filenames because "/" is the filesystem path seperator. So KDE encodes filenames and saves the filename like in http URL encoding with "%2f" for every "/".

I am convinced that this behavior is a bad idea and brings a lot of trouble.

I will now try to explain why.

  • "/" is not an allowed character in filenames of UNIX filesystems
  • AFAICT there is no other known OS or Desktop Environment (DE) that allows this
  • "%2f" is a valid filename
  • Allowing "/" in filenames brings following problems:
    • its not possible to have files containing %2f in the name for whatever reason even if escaped to %%2f then it would not be possible to have a file called like %%2f and be presented like that if not escaped ad %%%2f ...and so on
    • KDE is not an isolated world. People using it want to communicate to other people and to share files with them.
    • Bad interoperability: sending files with "/" in it to other people will always end up as apparently broken filenames on other systems if its not KDE (Gnome, XFCE, CDE, Windows). This may damage KDE's reputation in a way that people may think that KDE produces broken file(name)s now and then.
    • konqueror lists files and has a location bar. It is possible to access files directly through that location bar. Now if there is a file called "foo/bar" (foo%2fbar on disk) and a directory called foo containing a file called bar: what will be selected if a user enters this in the location bar? what will the user expect to hit? Wouldnt that make eval things possible? The same applies to krunner or the file-dialog. Because of that encoded filenames have to be treated special in some places and produce an inconsistent user experience.
  • Krusader shows files as they are on disk (foo%2fbar)
  • ark shows files as they are in an archive (foo%2fbar)
  • users often use the console to manage files in a batch
  • KDE is not compatible with linux coreutils (cp,mv,...) if it decodes and encodes filenames in a way that it will confuse people by the fact that files shown by "ls" look differently than files shown by dolphin or konqueror although there are just plain us-ascii characters being used for the filenames.


The solution

Marcs solution

I vote for just removing this feature to prevent all those problems described above and to solve the related bugreports.

Davids solution

I found a much better solution to allow '/' without all this escaping: using a unicode character that looks like a slash but that isn't '/': QChar(0x2044), also known as "FRACTION SLASH".Looks quite nice IMHO: http://web.davidfaure.fr/kde/slash.jpg

Ah... of course there's one downside: if you name a file "http://www.kde.org" you can't copy paste that name into the webbrowser as a URL, since the slashes are not real slashes anymore. Oh well, corner case of the corner case..

Related bugreports