[thelist] cross-platform file names

Jeffery To jeffery.to at gmx.net
Thu Apr 21 18:44:35 CDT 2005


Luther, Ron wrote:
> Jeffery To noted:
>>>I can see I'm probably not going to win any arguments here, 
> 
> Maybe there is a reason for that?  ;-)

I'm outnumbered. Bad things always happen when one is outnumbered :)

I agree that, in general, spaces in file names should be avoided. My 
only point of contention is that, having spaces in URLs should not be a 
reason against using spaces in file names. This is why I tried to limit 
my argument to RFC 2369.

There is a standard (Section 2.4 of RFC 2369) on escaping unsafe 
characters, such as the space character, within a URI. It is called URL 
encoding or escaping. This process converts each unsafe character into a 
printable character string, e.g. space into %20. This scheme works with 
unsafe symbols, accented and multi-byte characters (using UTF-8 
encoding). So the URL
   http://spaces.are/driving me mad (1)
becomes
   http://spaces.are/driving%20me%20mad (2)

When a user clicks on (2), the web server decodes the request to get 
(1), and does something to fulfill the request. There is no confusion as 
to what characters are used, from the time the user requests the 
resource to the time the server decodes the request.

There are plenty of valid reasons to not use spaces in file names. The 
COBOL program running on the mainframe in the basement chokes on spaces. 
The person in charge updating the website forgets to replace spaces with 
%20's. %20's are just plain ugly and everytime I see one I mentally 
vomit uncontrollably.

"The URI standard doesn't allow spaces" is not a valid reason.


Jeff

BTW I believe the practice of using spaces in URLs first got a bad 
reputation back when Internet Explorer ruled the world. IE would 
auto-convert literal spaces in URLs into %20's. Lazy coders got away 
with using literal spaces in their markup. Thus it became a sign of 
amateurism to use spaces in URLs. Of course no one actually bothers to 
check the markup to see whether or not the URLs are properly encoded.

(I promise to stop posting on this topic and go back to lurking.)


More information about the thelist mailing list