It will accept any combination of files or folders using drag and drop, run through the entire list of files and folders, and rename them according to two lists you can edit. The first list is characters that can cause problems in filenames, and the second list is characters that can cause problems if they are the first or last character in a file or folder name. You can change the substitute character, and the two lists, in the script properties.
It will preserve extensions and handle duplicate name conflicts. It also presents a dialog at the end showing how many files were checked, and how many files were renamed.
As always, copy the code and paste into a new AppleScript in Script Editor, and save as an Application with no splash screen. Also, as with anything like this, use at your own risk. I've tested it pretty well, it's fully commented and has error handing for the file rename routine, but I can't guarantee that it won't erase your hard drive.
[robg adds: I risked my hard drive :) and tested this script with a few oddly-named files and folders. It renamed them all without any issues, and it seems my hard drive is still full of data.]

