I have been bitten by this over the years of using Unix and Linux and this is quite an original solution.

Personally, I have got into the habit of either using Tab while typing an existing file name so that the shell formats it for me by adding backslashes before spaces and the like, or by enclosing such names in quotes. However, the strategy of avoiding creating such file names is a good one. 