On Sat, Jan 26, 2013 at 4:48 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:
Does anybody have a neat way to ensure that a given string only contains valid file name characters? I'm thinking of using translate() to replace illegal characters with e.g. an underscore, but what is legal and not legal? The list of illegal character is likely to be very long. All suggestions are welcome. Thanks.

I don't have a neat way, just a couple of comments.

What is illegal differs by platform of course.  Do you mean in general, or just on Windows?

Even on Windows, the list is not very long.  I've seen lists before, I just don't remember them off the top of my head.  Google should turn up some hits.

--
Mark Miesfeld