- Jul 11, 2004
- 21,867
- 7
- 81
I have a bunch of names in every language possible. I want to use these names to generate filenames that can be downloaded by any browser on any OS by somebody in any country. I need to make sure these filenames are going to be valid on their system. The filenames need to contain the name.
Up until now, I've only had to deal with English speaking countries, so I've just stripped all non-alphanumeric characters and replaced spaces. I got results like this:
"John Smith" -> "John_Smith.ext"
"John O'Henry" -> "John_OHenry.ext"
"John van Smith III" -> "John_van_Smith_III.ext"
This has been good enough...
Now I need to do the same thing for all countries. Stripping non-alphanumeric characters doesn't work for obvious reasons (e.g. Japanese names).
The best idea I've got so far is to find some sort of global list of characters that are not valid in filenames on any OS. Strip all of these characters. This is problematic because my list might be incomplete.
Any suggestions for how to do this?
Up until now, I've only had to deal with English speaking countries, so I've just stripped all non-alphanumeric characters and replaced spaces. I got results like this:
"John Smith" -> "John_Smith.ext"
"John O'Henry" -> "John_OHenry.ext"
"John van Smith III" -> "John_van_Smith_III.ext"
This has been good enough...
Now I need to do the same thing for all countries. Stripping non-alphanumeric characters doesn't work for obvious reasons (e.g. Japanese names).
The best idea I've got so far is to find some sort of global list of characters that are not valid in filenames on any OS. Strip all of these characters. This is problematic because my list might be incomplete.
Any suggestions for how to do this?
Last edited: