[thelist] cross-platform file names

Burhan Khalid thelist at meidomus.com
Wed Apr 20 08:26:31 CDT 2005


Fred D Yocum wrote:
> When naming files for the Web we have always had a policy of only using 
> alphanumeric characters,underscores and hyphens. This is to avoid 
> introducing cross-platform file naming problems (certain flavours of 
> Linux/Unix don't allow the 'space' character in file names). This is now 
> being challenged by a young upstart Web master who likes spaces in his 
> filenames particularly for files that are going to be downloaded onto 
> people's desktops.
> 
> Is this an issue any longer?

Still is an issue one that I (as I'm sure others) deal with daily.

Don't forget that browsers will convert spaces to %20, so your URLs will 
look hellish.  What would you rather have?

domain.com/annual-report-2004-condensed.doc

or

domain.com/annual%20report%202004%20condensed.doc

Along the same lines, try to keep your filenames in English only.  We 
had a problem where people were transferring files that were named in 
Arabic onto a Linux box.  All the file names were converted to ???. 
Lack of character set support in Linux.

Linux /can/ deal with spaces in files, but that doesn't mean that it 
should have to.  You can escape a space in a filename by prepending it 
with \ (on most Linux shells).

Windows allows files to be named in native character sets, but some 
Windows features don't work with all character sets.  For example, the 
built-in zip/unzip feature of XP doesn't work with filesnames that are 
in Arabic (and I suspect in other extended character sets).

I used to have a small bash+sed script that would replace all spaces in 
a filenames with a given character, or delete the space (so Hello 
Dolly.doc becomes HelloDolly.doc).  If I can find it again, I'll post it 
as a tip.

Sorry for going off on a tangent, but this is something that really 
pushes my buttons.

Regards,
Burhan


More information about the thelist mailing list