Deal with arguments with special characters better

Script now handles filenames with special characters (such as spaces,
hard tabs, newlines, double quotes and a dash prefix). The only
exceptions are filenames with single quotes. In this case, the script
will fail early with a clear error message.