Dont reinvent the wheel. Something like this will work: Custom function in BODS to remove special characters from a string
Just use this to look for spaces instead of a range of characters and replace it with a single space. May require tweaking to your exact needs, but this is a very powerful function.